gitgabrio commented on code in PR #6577:
URL:
https://github.com/apache/incubator-kie-drools/pull/6577#discussion_r2815778242
##########
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/lang/ast/UnaryTestNodeTest.java:
##########
@@ -93,4 +101,104 @@ private static Stream<Arguments>
provideElementsForEqualityTest() {
Arguments.of(null, 42, false, "Left null, right non-null")
);
}
+
+ /**
+ * Tests for evaluateRightValue method - without question mark
+ */
+
+ @Test
+ void testEvaluateRightValue_SimpleValue_WithoutQuestionMark() {
+ NumberNode valueNode = new NumberNode(BigDecimal.valueOf(42), "42");
+ UnaryTestNode unaryTestNode = new
UnaryTestNode(UnaryTestNode.UnaryOperator.EQ, valueNode);
+
+ EvaluationContext context = new
EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), new
FEELEventListenersManager(), FEELDialect.FEEL);
+ Object left = BigDecimal.valueOf(100);
+ Object result = unaryTestNode.evaluateRightValue(context, left);
+ assertThat(result).isEqualTo(BigDecimal.valueOf(42));
+ }
+
+ @Test
+ void testEvaluateRightValue_WithQuestionMark_NotInContext() {
+ NameRefNode questionMarkNode = new NameRefNode(BuiltInType.UNKNOWN,
"?");
+ UnaryTestNode unaryTestNode = new
UnaryTestNode(UnaryTestNode.UnaryOperator.EQ, questionMarkNode);
+
+ EvaluationContext context = new
EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), new
FEELEventListenersManager(), FEELDialect.FEEL);
+ Object left = BigDecimal.valueOf(123);
+ Object result = unaryTestNode.evaluateRightValue(context, left);
+ assertThat(result).isEqualTo(BigDecimal.valueOf(123));
+ }
+
+ @Test
+ void testEvaluateRightValue_WithQuestionMark_AlreadyInContext_SameValue() {
Review Comment:
I've the impression this test demonstrate a mistake in the overall logic
--
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]