You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "gitgabrio (via GitHub)" <gi...@apache.org> on 2025/12/04 08:58:27 UTC
Re: [PR] [incubator-kie-issues#2178] handle functionItem in ItemDefinition [incubator-kie-drools]
gitgabrio commented on code in PR #6535:
URL: https://github.com/apache/incubator-kie-drools/pull/6535#discussion_r2588135429
##########
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/ItemDefinitionDependenciesTest.java:
##########
@@ -227,4 +230,66 @@ void circular3() {
assertThat(orderedList.subList(0, 2)).contains(fhirAge, fhirExtension);
assertThat(orderedList.subList(2, 3)).contains(fhirT1);
}
-}
+
+ @Test
+ void testTypeRefWhenPresent() {
+ QName expected = new QName("ns", "date");
+ ItemDefinition item = new TItemDefinition();
+ item.setTypeRef(expected);
+
+ QName result = retrieveTypeRef(item, TEST_NS, DMNVersion.V1_2);
+ assertThat(expected).isEqualTo(result);
+ }
+
+ @Test
+ void testTypeRefNull() {
+ ItemDefinition item = new TItemDefinition();
+
+ QName result = retrieveTypeRef(item, TEST_NS, DMNVersion.V1_2);
+ assertThat(result).isNull();
+ }
+
+ @Test
+ void testRetrieveTypeRefFromFunctionItem() {
+ ItemDefinition id = new TItemDefinition();
+ FunctionItem fi = new TFunctionItem();
+ QName type = new QName("ns", "date");
Review Comment:
Hi @AthiraHari77
I've the impression that this `"ns"` should be replaced by `TEST_NS` (IINW, the two are the same "by chance")
##########
kie-dmn/kie-dmn-core/src/test/java/org/kie/dmn/core/compiler/ItemDefinitionDependenciesTest.java:
##########
@@ -227,4 +230,66 @@ void circular3() {
assertThat(orderedList.subList(0, 2)).contains(fhirAge, fhirExtension);
assertThat(orderedList.subList(2, 3)).contains(fhirT1);
}
-}
+
+ @Test
+ void testTypeRefWhenPresent() {
+ QName expected = new QName("ns", "date");
+ ItemDefinition item = new TItemDefinition();
+ item.setTypeRef(expected);
+
+ QName result = retrieveTypeRef(item, TEST_NS, DMNVersion.V1_2);
+ assertThat(expected).isEqualTo(result);
+ }
+
+ @Test
+ void testTypeRefNull() {
+ ItemDefinition item = new TItemDefinition();
+
+ QName result = retrieveTypeRef(item, TEST_NS, DMNVersion.V1_2);
+ assertThat(result).isNull();
+ }
+
+ @Test
+ void testRetrieveTypeRefFromFunctionItem() {
+ ItemDefinition id = new TItemDefinition();
+ FunctionItem fi = new TFunctionItem();
+ QName type = new QName("ns", "date");
+ fi.setOutputTypeRef(type);
+ id.setFunctionItem(fi);
+ QName result = retrieveTypeRef(id, TEST_NS, DMNVersion.V1_3);
+ assertThat(type).isEqualTo(result);
+ }
+
+ @Test
+ void retrieveTypeRef_withUnsupportedDMNVersion() {
+ ItemDefinition id = new TItemDefinition();
+ FunctionItem fi = new TFunctionItem();
+ QName type = new QName("ns", "date");
Review Comment:
Same comment above
--
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: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org