apirom9 commented on a change in pull request #472: Add more test inputs for 
ArrayUtils.toMap() method
URL: https://github.com/apache/commons-lang/pull/472#discussion_r338983320
 
 

 ##########
 File path: src/test/java/org/apache/commons/lang3/ArrayUtilsTest.java
 ##########
 @@ -264,6 +266,31 @@ public int hashCode() {
             }
         }});
         assertEquals("bar", map.get("foo"));
+
+        // Return empty map when got input array with length = 0
+        assertEquals(Collections.emptyMap(), ArrayUtils.toMap(new Object[0]));
+
+        // Test all null values
+        map = ArrayUtils.toMap(new Object[][] { {null, null}, {null, null} });
+        assertEquals(new HashMap<Object, Object>() {
+
+            private static final long serialVersionUID = 1L;
+
+            {
+                put(null, null);
+            }
+        }, map);
+
+        // Test duplicate keys
+        map = ArrayUtils.toMap(new Object[][] { {"key", "value2"}, {"key", 
"value1"} });
+        assertEquals(new HashMap<Object, Object>() {
+
+            private static final long serialVersionUID = 1L;
 
 Review comment:
   Fixed. Thanks

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to