diff --git a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/util/DefaultDMNMessagesManager.java b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/util/DefaultDMNMessagesManager.java index 0c30dfaed304..65154875c52b 100644 --- a/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/util/DefaultDMNMessagesManager.java +++ b/kie-dmn/kie-dmn-core/src/main/java/org/kie/dmn/core/util/DefaultDMNMessagesManager.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; import org.kie.api.io.Resource; @@ -100,7 +101,8 @@ public DMNMessage addMessage(DMNMessage.Severity severity, String message, DMNMe private boolean isDuplicate(DMNMessage existingMsg, DMNMessage newMessage) { return existingMsg.getMessageType().equals( newMessage.getMessageType() ) && - existingMsg.getSourceReference() == newMessage.getSourceReference(); + existingMsg.getSourceReference() == newMessage.getSourceReference() && + Objects.equals(existingMsg.getText(), newMessage.getText()); } } diff --git a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNRuntimeTest.java b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNRuntimeTest.java index fe302231d7f5..3700ee8f5f89 100644 --- a/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNRuntimeTest.java +++ b/kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/DMNRuntimeTest.java @@ -3172,4 +3172,19 @@ public void testSoundLevelAllowNullItemDef() { assertThat(dmnResult.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult.getMessages())).isFalse(); assertThat(dmnResult.getDecisionResultByName("Evaluation").getResult()).isEqualTo("Unknown"); } + + @Test + public void testKieIssue270() { + final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("habitability.dmn", this.getClass() ); + final DMNModel dmnModel = runtime.getModel("https://kiegroup.org/dmn/_93836704-04E9-45B6-8D10-51409FEBDF25", "habitability" ); + assertThat(dmnModel).isNotNull(); + assertThat(dmnModel.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnModel.getMessages())).isFalse(); + + final DMNContext context = DMNFactory.newContext(); + + final DMNResult dmnResult = runtime.evaluateAll(dmnModel, context); + assertThat(dmnResult.hasErrors()).as(DMNRuntimeUtil.formatMessages(dmnResult.getMessages())).isTrue(); + assertThat(dmnResult.getMessages()).hasSize(2); + assertThat(dmnResult.getMessages()).extracting(DMNMessage::getText).contains("DMN: Required dependency 'temperature' not found on node 'habitability' (DMN id: _0699341C-A1BE-4B6D-B8D5-3972D67FCA45, The referenced node was not found) ", "DMN: Required dependency 'oxygene' not found on node 'habitability' (DMN id: _0699341C-A1BE-4B6D-B8D5-3972D67FCA45, The referenced node was not found) "); + } } diff --git a/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/habitability.dmn b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/habitability.dmn new file mode 100644 index 000000000000..c60143d047f9 --- /dev/null +++ b/kie-dmn/kie-dmn-core/src/test/resources/org/kie/dmn/core/habitability.dmn @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + oxygene + + + + + temperature + + + + + + + [10..100] + + + < 40 + + + "somehow doable" + + + + + + + + <10 + + + < 40 + + + "hardly doable" + + + + + + + + - + + + >= 40 + + + "too hot" + + + + + + + + + + + + + 50 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file