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_r338826005
 
 

 ##########
 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>() {
 
 Review comment:
   Your expected map creation is too obtuse IMO, use the what Java provides 
instead:
   ```
   Collections.singletonMap(null, null);
   ```

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