ChinchuAjith commented on code in PR #6519:
URL:
https://github.com/apache/incubator-kie-drools/pull/6519#discussion_r2527287320
##########
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/lang/ast/InfixOperatorTest.java:
##########
@@ -74,6 +79,18 @@ void addLocalDateAndDuration() {
assertThat(retrieved).isEqualTo(LocalDate.of(2020, 12, 30));
}
+ //TODO : Added for testing purpose. Need to move to Bfeel specific test
class
+ @Test
+ void addStringAndNumber_shouldReturnConcatenatedString() {
+ FEELEventListenersManager manager = new FEELEventListenersManager();
+ EvaluationContextImpl ctx = new
EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), manager,
FEELDialect.BFEEL, DMNVersion.getLatest());
+ String left = "Total: ";
+ Integer right = 100;
+ Object result = InfixOperator.ADD.evaluate(left, right, ctx);
+ assertThat(result).isEqualTo("Total: 100");
+ //assertThat(result).isNull();
Review Comment:
Removed as the test is not required.
##########
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/ast/infixexecutors/InfixExecutorUtils.java:
##########
@@ -76,7 +79,48 @@ public static Object and(Object left, Object right,
EvaluationContext ctx) {
return l && r;
}
- static Object math(Object left, Object right, EvaluationContext ctx,
BinaryOperator<BigDecimal> op) {
+ /**
+ * Common method to manage Invalid Parameters Its behaviour depends on the
kind of FEEL syntax used (S-FEEL vs
+ * B-FEEL)
+ *
+ * @param ctx
+ */
+ public static void commonManageInvalidParameters(final EvaluationContext
ctx) {
+ FEELEvent.Severity severity =
ctx.getFEELDialect().equals(FEELDialect.BFEEL) ? FEELEvent.Severity.WARN
+ : FEELEvent.Severity.ERROR;
+ ctx.notifyEvt(() -> new InvalidParametersEvent(severity,
Msg.OPERATION_IS_UNDEFINED_FOR_PARAMETERS.getMask()));
+ }
+
+ public static BigDecimal getBigDecimal(Object object, EvaluationContext
ctx) {
+ if (ctx.getFEELDialect().equals(FEELDialect.BFEEL)) {
+ if (! (object instanceof Number)) {
Review Comment:
Done
--
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]