yesamer commented on code in PR #6538:
URL: 
https://github.com/apache/incubator-kie-drools/pull/6538#discussion_r2589524160


##########
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/util/CoerceUtilTest.java:
##########
@@ -167,6 +167,39 @@ void actualCoerceValueCollectionToArray() {
         assertThat(retrieved).isEqualTo(item);
     }
 
+    @Test
+    void testCoerceValueToCollection() {
+        Object item = "TESTED_OBJECT";
+        Object value = Collections.singletonList(item);
+        DMNType requiredType = new 
SimpleTypeImpl("http://www.omg.org/spec/DMN/20180521/FEEL/";,
+                "string",
+                null,
+                true,
+                null,
+                null,
+                null,
+                BuiltInType.STRING);
+        Object retrieved = CoerceUtil.actualCoerceValue(requiredType, item);
+        assertThat(retrieved).isNotNull();
+        assertThat(retrieved).isEqualTo(value);
+    }
+
+    @Test
+    void testCoerceValueToCollectionTypeAny() {
+        Object item = "TESTED_OBJECT";
+        DMNType requiredType = new 
SimpleTypeImpl("http://www.omg.org/spec/DMN/20180521/FEEL/";,
+                "Any",
+                null,
+                true,
+                null,
+                null,
+                null,
+                BuiltInType.UNKNOWN);
+        Object retrieved = CoerceUtil.actualCoerceValue(requiredType, item);
+        assertThat(retrieved).isNotNull();
+        assertThat(retrieved).isEqualTo(item);

Review Comment:
   @gitgabrio The scope of that test is to check the 
`SimpleTypeImpl.UNKNOWN_DMNTYPE` (eg. Any) type scenario. We discovered that 
type is always considered a collection (it looks weird to me, but that 
assumption is present since the beginning of the DMN Engine). To summarize, if 
the requiredType = ANY, the coercion shouldn't be applied.



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