pibizza commented on code in PR #6080:
URL:
https://github.com/apache/incubator-kie-drools/pull/6080#discussion_r1756779320
##########
kie-dmn/kie-dmn-signavio/src/test/java/org/kie/dmn/signavio/SignavioTest.java:
##########
@@ -291,31 +293,45 @@ void signavioIterateMultiinstanceWithComplexInputs() {
@Test
void signavioIterateMultiinstanceMultipleDecisions() {
DMNRuntime runtime = createRuntime("MID with multiple inside
decisions.dmn");
-
+
DMNContext context = runtime.newContext();
context.set("names", Arrays.asList("John", "Alice"));
-
+
DMNModel model0 = runtime.getModels().get(0);
LOG.info("EVALUATE ALL:");
DMNResult evaluateAll = runtime.evaluateAll(model0, context);
LOG.info("{}", evaluateAll);
-
+
assertThat(evaluateAll.getDecisionResultByName("overallage").getResult()).isEqualTo(new
BigDecimal("18"));
}
@Test
void signavioIterateMultiinstanceMultipleDecisionsOutside() {
DMNRuntime runtime = createRuntime("MID with outside requirement.dmn");
-
+
DMNContext context = runtime.newContext();
context.set("numbers", Arrays.asList(1,2,3));
context.set("operand", "PLUS");
-
+
DMNModel model0 = runtime.getModels().get(0);
LOG.info("EVALUATE ALL:");
DMNResult evaluateAll = runtime.evaluateAll(model0, context);
LOG.info("{}", evaluateAll);
-
+
assertThat(evaluateAll.getDecisionResultByName("sumUp").getResult()).isEqualTo(new
BigDecimal("6"));
}
+
+ @Test
+ void signavioMultiInstanceDecisionTableWithinMultipleFiles() {
+ DMNRuntime dmnRuntime = createRuntime("MID with outside
requirement.dmn", "survey MID SUM.dmn", "Signavio_Concat.dmn");
+
+ List<String> decisionNames = dmnRuntime
+ .getModels()
+ .stream()
+ .flatMap(dmnModel -> dmnModel.getDecisions().stream())
+ .map(DMNNode::getName)
+ .collect(Collectors.toList());
+
+ assertThat(decisionNames).containsOnly("sumUp", "iterating",
"determineModifier", "concatNames");
Review Comment:
Maybe you can simply this and the previous statement using directly assertj
assertions. Assertj has a powerful fluent interface to manipulate streams and
perform stream operation. You can check extracting and flatExtracting, for
example.
```suggestion
assertThat(dmnRuntime.getModels()).flatExtracting(dmnModel ->
dmnModel.getDecisions()).extracting(DMNNode::getName).containsOnly("sumUp",
"iterating", "determineModifier", "concatNames");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]