commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [commons-lang] garydgregory commented on a change in pull request #472: Add more test inputs for ArrayUtils.toMap() method
Date Thu, 24 Oct 2019 22:56:33 GMT
garydgregory 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_r338826094
 
 

 ##########
 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:
   See my previous comment.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message