gitgabrio commented on code in PR #6040:
URL:
https://github.com/apache/incubator-kie-drools/pull/6040#discussion_r1700269724
##########
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/FEEL12ExtendedForLoopTest.java:
##########
@@ -45,10 +45,15 @@ protected void instanceTest(String expression, Object
result, FEELEvent.Severity
}
private static Collection<Object[]> data() {
+ List<Integer> nullObject = new ArrayList<>();
+ nullObject.add(null);
+ nullObject.add(null);
+ nullObject.add(null);
final Object[][] cases = new Object[][] {
//normal:
{"for x in [1, 2, 3] return x+1", Stream.of(1, 2, 3 ).map(x ->
BigDecimal.valueOf(x + 1 ) ).collect(Collectors.toList() ), null},
- {"for x in @\"2021-01-01\"..@\"2021-01-03\" return x+1",
Stream.of("2021-01-02", "2021-01-03", "2021-01-04"
).map(LocalDate::parse).collect(Collectors.toList() ), null},
+ {"for x in @\"2021-01-01\"..@\"2021-01-03\" return x +
@\"P1D\"", Stream.of("2021-01-02", "2021-01-03", "2021-01-04"
).map(LocalDate::parse).collect(Collectors.toList() ), null},
+ {"for x in @\"2021-01-01\"..@\"2021-01-03\" return x+1",
nullObject, FEELEvent.Severity.ERROR},
Review Comment:
@yesamer
The `for x....` iterates over all the elements, and for each element the
`+1` is executed.
Since the `date + number` operation returns `null`, every single iteration
is mapped to `null`.
So, I'm expecting to have a list of `null`
Very similar to `stream.map`: does this make sense ? Am I clear ?
Please, correct me if I'm wrong
--
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]