gitgabrio commented on code in PR #5645:
URL:
https://github.com/apache/incubator-kie-drools/pull/5645#discussion_r1450708936
##########
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/runtime/FEELFunctionsTest.java:
##########
@@ -237,6 +237,12 @@ public static Collection<Object[]> data() {
{ "{a: -2, r: -sum( 1, -abs(a), 3 )}.r", BigDecimal.valueOf(
-2 ) , null},
{ "if list contains ([2.2, 3.0, 4.0], 3) then \"OK\" else
\"NOT_OK\"", "OK" , null},
{ "if list contains ([2.2, 3, 4], 3.000) then \"OK\" else
\"NOT_OK\"", "OK" , null},
+ {"list replace ( null, 3, 6)", null ,
FEELEvent.Severity.ERROR},
+ {"list replace ( [2, 4, 7, 8], null, 6)", null ,
FEELEvent.Severity.ERROR},
+ {"list replace ( [2, 4, 7, 8], 3, 6)",
Arrays.asList(BigDecimal.valueOf(2), BigDecimal.valueOf(4),
BigDecimal.valueOf(6), BigDecimal.valueOf(8)), null},
+ {"list replace ( [2, 4, 7, 8], function(item, newItem) item +
newItem, 6)", null , FEELEvent.Severity.ERROR},
+ {"list replace ( [\"El-1\", \"El-2\", \"El-3\", \"El-4\"],
function(item, newItem) item = \"El-2\", null)", Arrays.asList("El-1", null,
"El-3", "El-4"), null},
+ {"list replace ( [2, 4, 7, 8], function(item, newItem) item <
newItem, 5)", Arrays.asList(BigDecimal.valueOf(5), BigDecimal.valueOf(5),
BigDecimal.valueOf(7), BigDecimal.valueOf(8)), null}
Review Comment:
I _guess_ beacuse the matching function _could_ depend on both (current)
item and newItem: would it be possible to achieve that with a function with
only one argument (I just started working on DMN specs)?
Anyway, I also wrote a test where the match function does not use the
`newItem` at all, since, reading the documentation, seems a valid use case
(e.g. if a number is even, replace with the newItem)
--
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]