gitgabrio commented on code in PR #6632:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6632#discussion_r3098869386


##########
kie-dmn/kie-dmn-feel/src/test/java/org/kie/dmn/feel/lang/ast/dialectHandlers/BFEELDialectHandlerTest.java:
##########
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.dmn.feel.lang.ast.dialectHandlers;
+
+import java.math.BigDecimal;
+import java.time.Duration;
+import java.time.LocalDate;
+import java.time.Period;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.kie.dmn.feel.lang.EvaluationContext;
+import org.kie.dmn.feel.lang.types.impl.ComparablePeriod;
+import org.kie.dmn.feel.util.EvaluationContextTestUtil;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Unit tests for BFEELDialectHandler - BFEEL uses type coercion and returns 
default values
+ */
+class BFEELDialectHandlerTest {
+
+    private BFEELDialectHandler handler;
+    private EvaluationContext ctx;
+
+    @BeforeEach
+    void setUp() {
+        handler = new BFEELDialectHandler();
+        ctx = EvaluationContextTestUtil.newEmptyEvaluationContext();
+    }
+
+    @Test
+    void testAddOperations() {
+        // String concatenation with type coercion
+        assertThat(handler.executeAdd("Hello", "World", 
ctx)).isEqualTo("HelloWorld");
+        assertThat(handler.executeAdd("Hello", 123, 
ctx)).isEqualTo("Hello123");
+        assertThat(handler.executeAdd("Hello", null, ctx)).isEqualTo("Hello");
+        
+        // Numbers
+        assertThat(handler.executeAdd(10, 20, ctx)).isEqualTo(new 
BigDecimal("30"));
+        assertThat(handler.executeAdd(10, null, ctx)).isEqualTo(10);
+        
+        // Date operations - returns number instead of null
+        assertThat(handler.executeAdd(LocalDate.of(2024, 1, 1), 5, 
ctx)).isEqualTo(5);

Review Comment:
   @yesamer @ChinchuAjith 
   
   This is very tricky. I think you are right with that, but we need to double 
check everyone.
   My interpretation is:
   1. normal FEEL defines valid addiction/subtraction with Table 58
   2. for BFEEL, we have to "extend" this table for invalid cases, with the 
Table at 11.9
   3. the order of the rows in that latter take precedence, so if there is a 
number, everything has to be considered a number.
   
   But, please, double check yourself.
   
   @ChinchuAjith would it be possible to create a test for each row in that 
latter table , with parameters at both left and right side ?
   



-- 
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]

Reply via email to