fjtirado commented on code in PR #2180:
URL: 
https://github.com/apache/incubator-kie-kogito-apps/pull/2180#discussion_r1930773443


##########
data-index/data-index-common/src/test/java/org/kie/kogito/index/CommonUtilsTest.java:
##########
@@ -51,4 +51,90 @@ void testComplexMergeMap() {
         Map<String, Object> target = Map.of("nested", nestedTarget);
         assertThat(CommonUtils.mergeMap(src, 
target)).isEqualTo(Map.of("nested", Map.of("name", "Javierito", "other", 
"remain", "different", "remain")));
     }
+
+    @Test
+    void testMergeWithEmptySource() {
+        Map<String, String> target = Map.of("name", "Fulanito");
+        assertThat(CommonUtils.mergeMap(Map.of(), target)).isEqualTo(target);
+    }
+
+    @Test
+    void testMergeWithEmptyTarget() {
+        Map<String, String> source = Map.of("name", "Javierito");
+        assertThat(CommonUtils.mergeMap(source, Map.of())).isEqualTo(source);
+    }
+
+    @Test
+    void testMergeWithNullSource() {
+        Map<String, String> target = Map.of("name", "Gonzalito");
+        assertThat(CommonUtils.mergeMap(null, target)).isEqualTo(target);
+    }
+
+    @Test
+    void testMergeWithNullTarget() {
+        Map<String, String> source = Map.of("name", "Francisquito");
+        assertThat(CommonUtils.mergeMap(source, null)).isEqualTo(source);
+    }
+
+    @Test
+    void testMergeWithNonMapNestedValueInSource() {
+        Map<String, Object> src = Map.of("nested", "newValue");
+        Map<String, Object> target = Map.of("nested", Map.of("key", "value"));
+        assertThat(CommonUtils.mergeMap(src, 
target)).isEqualTo(Map.of("nested", "newValue"));
+    }
+
+    @Test
+    void testMergeWithNonMapNestedValueInTarget() {
+        Map<String, Object> src = Map.of("nested", Map.of("key", "newValue"));
+        Map<String, Object> target = Map.of("nested", "oldValue");
+        assertThat(CommonUtils.mergeMap(src, 
target)).isEqualTo(Map.of("nested", Map.of("key", "newValue")));
+    }
+
+    @Test
+    void testMergeWithConflictingNonMapNestedValues() {
+        Map<String, Object> src = Map.of("key", "newValue");
+        Map<String, Object> target = Map.of("key", Map.of("nestedKey", 
"oldValue"));
+        assertThat(CommonUtils.mergeMap(src, target)).isEqualTo(Map.of("key", 
"newValue"));
+    }
+
+    @Test
+    void testMergeWithDeeplyNestedMaps() {
+        Map<String, Object> src = Map.of("nested", Map.of("deepKey", 
Map.of("key1", "value1")));
+        Map<String, Object> target = Map.of("nested", Map.of("deepKey", 
Map.of("key2", "value2")));
+        assertThat(CommonUtils.mergeMap(src, target)).isEqualTo(
+                Map.of("nested", Map.of("deepKey", Map.of("key1", "value1", 
"key2", "value2"))));
+    }
+
+    @Test
+    void testMergeWithEmptyNestedMaps() {
+        Map<String, Object> src = Map.of("nested", Map.of());
+        Map<String, Object> target = Map.of("nested", Map.of("key", "value"));
+        assertThat(CommonUtils.mergeMap(src, 
target)).isEqualTo(Map.of("nested", Map.of("key", "value")));
+    }
+
+    @Test
+    void testMergeWithMixedKeyTypes() {
+        Map<Object, String> src = Map.of(1, "value1", "key", "value2");
+        Map<Object, String> target = Map.of(1, "value3", "otherKey", "value4");
+        assertThat(CommonUtils.mergeMap(src, target)).isEqualTo(Map.of(1, 
"value1", "key", "value2", "otherKey", "value4"));
+    }
+
+    @Test

Review Comment:
   I think this test superseeds this one 
https://github.com/apache/incubator-kie-kogito-apps/blob/b368764c99f04c547c54843ef01d113527372c27/data-index/data-index-common/src/test/java/org/kie/kogito/index/CommonUtilsTest.java#L36C1-L44C6,
 so you can remove it



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