You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/27 19:33:06 UTC

[commons-collections] branch master updated (ba85c69 -> 4a980fa)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git.


    from ba85c69  Bump maven-antrun-plugin from 1.8 to 3.0.0 (#170)
     new 7c4a499  Sort members.
     new ad99cf8  Remove dead comments.
     new 743af0b  Remove dead comments.
     new 1c7ffa6  Sort members.
     new 283b1ba  Bump maven-antrun-plugin from 1.8 to 3.0.0 #170.
     new 4a980fa  Merge branch 'master' of https://ggregory@gitbox.apache.org/repos/asf/commons-collections

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                            |   3 +
 .../collections4/map/CaseInsensitiveMapTest.java   | 110 +++++-----
 .../collections4/map/ReferenceIdentityMapTest.java | 227 ++++++++++-----------
 3 files changed, 169 insertions(+), 171 deletions(-)


[commons-collections] 01/06: Sort members.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 7c4a4994cbb58313f8d6f7a39ec79b435f3b8b93
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Nov 26 10:15:07 2020 -0500

    Sort members.
---
 .../collections4/map/ReferenceIdentityMapTest.java | 228 ++++++++++-----------
 1 file changed, 114 insertions(+), 114 deletions(-)

diff --git a/src/test/java/org/apache/commons/collections4/map/ReferenceIdentityMapTest.java b/src/test/java/org/apache/commons/collections4/map/ReferenceIdentityMapTest.java
index 1ccc8ec..60791fa 100644
--- a/src/test/java/org/apache/commons/collections4/map/ReferenceIdentityMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/ReferenceIdentityMapTest.java
@@ -37,35 +37,44 @@ public class ReferenceIdentityMapTest<K, V> extends AbstractIterableMapTest<K, V
     private static final Integer I2A = new Integer(2);
     private static final Integer I2B = new Integer(2);
 
-    public ReferenceIdentityMapTest(final String testName) {
-        super(testName);
+    @SuppressWarnings("unused")
+    private static void gc() {
+        try {
+            // trigger GC
+            final byte[][] tooLarge = new byte[1000000000][1000000000];
+            fail("you have too much RAM");
+        } catch (final OutOfMemoryError ex) {
+            System.gc(); // ignore
+        }
     }
 
     public static Test suite() {
         return BulkTest.makeSuite(ReferenceIdentityMapTest.class);
     }
 
-    @Override
-    public ReferenceIdentityMap<K, V> makeObject() {
-        return new ReferenceIdentityMap<>(ReferenceStrength.WEAK, ReferenceStrength.WEAK);
-    }
+    WeakReference<K> keyReference;
 
-    @Override
-    public Map<K, V> makeConfirmedMap() {
-        // Testing against another [collections] class generally isn't a good idea,
-        // but the closest alternative is IdentityHashMap, which propagates reference-equality down to keySet and values.
-        // arguably ReferenceIdentityMap should do the same but that's a later discussion.
-        return new IdentityMap<>();
-    }
+    WeakReference<V> valueReference;
 
-    @Override
-    public boolean isAllowNullKey() {
-        return false;
+    public ReferenceIdentityMapTest(final String testName) {
+        super(testName);
     }
 
-    @Override
-    public boolean isAllowNullValue() {
-        return false;
+    @SuppressWarnings("unchecked")
+    private Map<K, V> buildRefMap() {
+        final K key = (K) new Object();
+        final V value = (V) new Object();
+
+        keyReference = new WeakReference<>(key);
+        valueReference = new WeakReference<>(value);
+
+        final Map<K, V> testMap = new ReferenceIdentityMap<>(ReferenceStrength.WEAK, ReferenceStrength.HARD, true);
+        testMap.put(key, value);
+
+        assertEquals("In map", value, testMap.get(key));
+        assertNotNull("Weak reference released early (1)", keyReference.get());
+        assertNotNull("Weak reference released early (2)", valueReference.get());
+        return testMap;
     }
 
     @Override
@@ -84,81 +93,22 @@ public class ReferenceIdentityMapTest<K, V> extends AbstractIterableMapTest<K, V
 //            "src/test/resources/data/test/ReferenceIdentityMap.fullCollection.version4.obj");
 //    }
 
-    //-----------------------------------------------------------------------
-    @SuppressWarnings("unchecked")
-    public void testBasics() {
-        final IterableMap<K, V> map = new ReferenceIdentityMap<>(ReferenceStrength.HARD, ReferenceStrength.HARD);
-        assertEquals(0, map.size());
-
-        map.put((K) I1A, (V) I2A);
-        assertEquals(1, map.size());
-        assertSame(I2A, map.get(I1A));
-        assertSame(null, map.get(I1B));
-        assertEquals(true, map.containsKey(I1A));
-        assertEquals(false, map.containsKey(I1B));
-        assertEquals(true, map.containsValue(I2A));
-        assertEquals(false, map.containsValue(I2B));
-
-        map.put((K) I1A, (V) I2B);
-        assertEquals(1, map.size());
-        assertSame(I2B, map.get(I1A));
-        assertSame(null, map.get(I1B));
-        assertEquals(true, map.containsKey(I1A));
-        assertEquals(false, map.containsKey(I1B));
-        assertEquals(false, map.containsValue(I2A));
-        assertEquals(true, map.containsValue(I2B));
-
-        map.put((K) I1B, (V) I2B);
-        assertEquals(2, map.size());
-        assertSame(I2B, map.get(I1A));
-        assertSame(I2B, map.get(I1B));
-        assertEquals(true, map.containsKey(I1A));
-        assertEquals(true, map.containsKey(I1B));
-        assertEquals(false, map.containsValue(I2A));
-        assertEquals(true, map.containsValue(I2B));
+    @Override
+    public boolean isAllowNullKey() {
+        return false;
     }
 
-    //-----------------------------------------------------------------------
-    @SuppressWarnings("unchecked")
-    public void testHashEntry() {
-        final IterableMap<K, V> map = new ReferenceIdentityMap<>(ReferenceStrength.HARD, ReferenceStrength.HARD);
-
-        map.put((K) I1A, (V) I2A);
-        map.put((K) I1B, (V) I2A);
-
-        final Map.Entry<K, V> entry1 = map.entrySet().iterator().next();
-        final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
-        final Map.Entry<K, V> entry2 = it.next();
-        final Map.Entry<K, V> entry3 = it.next();
-
-        assertEquals(true, entry1.equals(entry2));
-        assertEquals(true, entry2.equals(entry1));
-        assertEquals(false, entry1.equals(entry3));
+    @Override
+    public boolean isAllowNullValue() {
+        return false;
     }
 
-    //-----------------------------------------------------------------------
-    @SuppressWarnings("unchecked")
-    public void testNullHandling() {
-        resetFull();
-        assertEquals(null, getMap().get(null));
-        assertEquals(false, getMap().containsKey(null));
-        assertEquals(false, getMap().containsValue(null));
-        assertEquals(null, getMap().remove(null));
-        assertEquals(false, getMap().entrySet().contains(null));
-        assertEquals(false, getMap().keySet().contains(null));
-        assertEquals(false, getMap().values().contains(null));
-        try {
-            getMap().put(null, null);
-            fail();
-        } catch (final NullPointerException ex) {}
-        try {
-            getMap().put((K) new Object(), null);
-            fail();
-        } catch (final NullPointerException ex) {}
-        try {
-            getMap().put(null, (V) new Object());
-            fail();
-        } catch (final NullPointerException ex) {}
+    @Override
+    public Map<K, V> makeConfirmedMap() {
+        // Testing against another [collections] class generally isn't a good idea,
+        // but the closest alternative is IdentityHashMap, which propagates reference-equality down to keySet and values.
+        // arguably ReferenceIdentityMap should do the same but that's a later discussion.
+        return new IdentityMap<>();
     }
 
     //-----------------------------------------------------------------------
@@ -272,24 +222,85 @@ public class ReferenceIdentityMapTest<K, V> extends AbstractIterableMapTest<K, V
     }
 */
 
-    WeakReference<K> keyReference;
-    WeakReference<V> valueReference;
+    @Override
+    public ReferenceIdentityMap<K, V> makeObject() {
+        return new ReferenceIdentityMap<>(ReferenceStrength.WEAK, ReferenceStrength.WEAK);
+    }
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
+    public void testBasics() {
+        final IterableMap<K, V> map = new ReferenceIdentityMap<>(ReferenceStrength.HARD, ReferenceStrength.HARD);
+        assertEquals(0, map.size());
 
+        map.put((K) I1A, (V) I2A);
+        assertEquals(1, map.size());
+        assertSame(I2A, map.get(I1A));
+        assertSame(null, map.get(I1B));
+        assertEquals(true, map.containsKey(I1A));
+        assertEquals(false, map.containsKey(I1B));
+        assertEquals(true, map.containsValue(I2A));
+        assertEquals(false, map.containsValue(I2B));
+
+        map.put((K) I1A, (V) I2B);
+        assertEquals(1, map.size());
+        assertSame(I2B, map.get(I1A));
+        assertSame(null, map.get(I1B));
+        assertEquals(true, map.containsKey(I1A));
+        assertEquals(false, map.containsKey(I1B));
+        assertEquals(false, map.containsValue(I2A));
+        assertEquals(true, map.containsValue(I2B));
+
+        map.put((K) I1B, (V) I2B);
+        assertEquals(2, map.size());
+        assertSame(I2B, map.get(I1A));
+        assertSame(I2B, map.get(I1B));
+        assertEquals(true, map.containsKey(I1A));
+        assertEquals(true, map.containsKey(I1B));
+        assertEquals(false, map.containsValue(I2A));
+        assertEquals(true, map.containsValue(I2B));
+    }
+
+    //-----------------------------------------------------------------------
     @SuppressWarnings("unchecked")
-    private Map<K, V> buildRefMap() {
-        final K key = (K) new Object();
-        final V value = (V) new Object();
+    public void testHashEntry() {
+        final IterableMap<K, V> map = new ReferenceIdentityMap<>(ReferenceStrength.HARD, ReferenceStrength.HARD);
 
-        keyReference = new WeakReference<>(key);
-        valueReference = new WeakReference<>(value);
+        map.put((K) I1A, (V) I2A);
+        map.put((K) I1B, (V) I2A);
 
-        final Map<K, V> testMap = new ReferenceIdentityMap<>(ReferenceStrength.WEAK, ReferenceStrength.HARD, true);
-        testMap.put(key, value);
+        final Map.Entry<K, V> entry1 = map.entrySet().iterator().next();
+        final Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();
+        final Map.Entry<K, V> entry2 = it.next();
+        final Map.Entry<K, V> entry3 = it.next();
 
-        assertEquals("In map", value, testMap.get(key));
-        assertNotNull("Weak reference released early (1)", keyReference.get());
-        assertNotNull("Weak reference released early (2)", valueReference.get());
-        return testMap;
+        assertEquals(true, entry1.equals(entry2));
+        assertEquals(true, entry2.equals(entry1));
+        assertEquals(false, entry1.equals(entry3));
+    }
+
+    //-----------------------------------------------------------------------
+    @SuppressWarnings("unchecked")
+    public void testNullHandling() {
+        resetFull();
+        assertEquals(null, getMap().get(null));
+        assertEquals(false, getMap().containsKey(null));
+        assertEquals(false, getMap().containsValue(null));
+        assertEquals(null, getMap().remove(null));
+        assertEquals(false, getMap().entrySet().contains(null));
+        assertEquals(false, getMap().keySet().contains(null));
+        assertEquals(false, getMap().values().contains(null));
+        try {
+            getMap().put(null, null);
+            fail();
+        } catch (final NullPointerException ex) {}
+        try {
+            getMap().put((K) new Object(), null);
+            fail();
+        } catch (final NullPointerException ex) {}
+        try {
+            getMap().put(null, (V) new Object());
+            fail();
+        } catch (final NullPointerException ex) {}
     }
 
     /** Tests whether purge values setting works */
@@ -318,15 +329,4 @@ public class ReferenceIdentityMapTest<K, V> extends AbstractIterableMapTest<K, V
         }
     }
 
-    @SuppressWarnings("unused")
-    private static void gc() {
-        try {
-            // trigger GC
-            final byte[][] tooLarge = new byte[1000000000][1000000000];
-            fail("you have too much RAM");
-        } catch (final OutOfMemoryError ex) {
-            System.gc(); // ignore
-        }
-    }
-
 }


[commons-collections] 05/06: Bump maven-antrun-plugin from 1.8 to 3.0.0 #170.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 283b1ba587b51ae582cd6eb123de69a4b1643a95
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 27 14:32:44 2020 -0500

    Bump maven-antrun-plugin from 1.8 to 3.0.0 #170.
---
 src/changes/changes.xml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 4dc438f..46475f2 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -213,6 +213,9 @@
     <action type="update" dev="ggregory" due-to="Dependabot">
       Bump commons.junit.version from 5.6.2 to 5.7.0 #181.
     </action>
+    <action type="update" dev="ggregory" due-to="Dependabot">
+      Bump maven-antrun-plugin from 1.8 to 3.0.0 #170.
+    </action>
   </release>
   <release version="4.4" date="2019-07-05" description="Maintenance release.">
     <action issue="COLLECTIONS-710" dev="ggregory" type="fix" due-to="Yu Shi, Gary Gregory">


[commons-collections] 02/06: Remove dead comments.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit ad99cf8c17eb31a09edf4e9b623eb600c355b2f6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Nov 26 10:15:56 2020 -0500

    Remove dead comments.
---
 .../apache/commons/collections4/map/ReferenceIdentityMapTest.java    | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/test/java/org/apache/commons/collections4/map/ReferenceIdentityMapTest.java b/src/test/java/org/apache/commons/collections4/map/ReferenceIdentityMapTest.java
index 60791fa..3389b4c 100644
--- a/src/test/java/org/apache/commons/collections4/map/ReferenceIdentityMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/ReferenceIdentityMapTest.java
@@ -111,7 +111,6 @@ public class ReferenceIdentityMapTest<K, V> extends AbstractIterableMapTest<K, V
         return new IdentityMap<>();
     }
 
-    //-----------------------------------------------------------------------
 /*
     // Tests often fail because gc is uncontrollable
 
@@ -226,7 +225,7 @@ public class ReferenceIdentityMapTest<K, V> extends AbstractIterableMapTest<K, V
     public ReferenceIdentityMap<K, V> makeObject() {
         return new ReferenceIdentityMap<>(ReferenceStrength.WEAK, ReferenceStrength.WEAK);
     }
-    //-----------------------------------------------------------------------
+
     @SuppressWarnings("unchecked")
     public void testBasics() {
         final IterableMap<K, V> map = new ReferenceIdentityMap<>(ReferenceStrength.HARD, ReferenceStrength.HARD);
@@ -260,7 +259,6 @@ public class ReferenceIdentityMapTest<K, V> extends AbstractIterableMapTest<K, V
         assertEquals(true, map.containsValue(I2B));
     }
 
-    //-----------------------------------------------------------------------
     @SuppressWarnings("unchecked")
     public void testHashEntry() {
         final IterableMap<K, V> map = new ReferenceIdentityMap<>(ReferenceStrength.HARD, ReferenceStrength.HARD);
@@ -278,7 +276,6 @@ public class ReferenceIdentityMapTest<K, V> extends AbstractIterableMapTest<K, V
         assertEquals(false, entry1.equals(entry3));
     }
 
-    //-----------------------------------------------------------------------
     @SuppressWarnings("unchecked")
     public void testNullHandling() {
         resetFull();


[commons-collections] 03/06: Remove dead comments.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 743af0bb1f3b5a101de4f219064ea824f462d73e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Nov 26 10:16:56 2020 -0500

    Remove dead comments.
---
 .../org/apache/commons/collections4/map/CaseInsensitiveMapTest.java     | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/test/java/org/apache/commons/collections4/map/CaseInsensitiveMapTest.java b/src/test/java/org/apache/commons/collections4/map/CaseInsensitiveMapTest.java
index 5530bc9..0273dd9 100644
--- a/src/test/java/org/apache/commons/collections4/map/CaseInsensitiveMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/CaseInsensitiveMapTest.java
@@ -49,8 +49,6 @@ public class CaseInsensitiveMapTest<K, V> extends AbstractIterableMapTest<K, V>
         return "4";
     }
 
-    //-------------------------------------------------------------------------
-
     @SuppressWarnings("unchecked")
     public void testCaseInsensitive() {
         final Map<K, V> map = makeObject();


[commons-collections] 04/06: Sort members.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 1c7ffa63facd6017022c2ac32071fa3415f1d4fc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Nov 26 10:17:07 2020 -0500

    Sort members.
---
 .../collections4/map/CaseInsensitiveMapTest.java   | 110 ++++++++++-----------
 1 file changed, 55 insertions(+), 55 deletions(-)

diff --git a/src/test/java/org/apache/commons/collections4/map/CaseInsensitiveMapTest.java b/src/test/java/org/apache/commons/collections4/map/CaseInsensitiveMapTest.java
index 0273dd9..1f6a0ef 100644
--- a/src/test/java/org/apache/commons/collections4/map/CaseInsensitiveMapTest.java
+++ b/src/test/java/org/apache/commons/collections4/map/CaseInsensitiveMapTest.java
@@ -31,17 +31,12 @@ import org.apache.commons.collections4.BulkTest;
  */
 public class CaseInsensitiveMapTest<K, V> extends AbstractIterableMapTest<K, V> {
 
-    public CaseInsensitiveMapTest(final String testName) {
-        super(testName);
-    }
-
     public static Test suite() {
         return BulkTest.makeSuite(CaseInsensitiveMapTest.class);
     }
 
-    @Override
-    public CaseInsensitiveMap<K, V> makeObject() {
-        return new CaseInsensitiveMap<>();
+    public CaseInsensitiveMapTest(final String testName) {
+        super(testName);
     }
 
     @Override
@@ -49,6 +44,11 @@ public class CaseInsensitiveMapTest<K, V> extends AbstractIterableMapTest<K, V>
         return "4";
     }
 
+    @Override
+    public CaseInsensitiveMap<K, V> makeObject() {
+        return new CaseInsensitiveMap<>();
+    }
+
     @SuppressWarnings("unchecked")
     public void testCaseInsensitive() {
         final Map<K, V> map = makeObject();
@@ -61,42 +61,6 @@ public class CaseInsensitiveMapTest<K, V> extends AbstractIterableMapTest<K, V>
     }
 
     @SuppressWarnings("unchecked")
-    public void testNullHandling() {
-        final Map<K, V> map = makeObject();
-        map.put((K) "One", (V) "One");
-        map.put((K) "Two", (V) "Two");
-        map.put(null, (V) "Three");
-        assertEquals("Three", map.get(null));
-        map.put(null, (V) "Four");
-        assertEquals("Four", map.get(null));
-        final Set<K> keys = map.keySet();
-        assertTrue(keys.contains("one"));
-        assertTrue(keys.contains("two"));
-        assertTrue(keys.contains(null));
-        assertEquals(3, keys.size());
-    }
-
-    public void testPutAll() {
-        final Map<Object, String> map = new HashMap<>();
-        map.put("One", "One");
-        map.put("Two", "Two");
-        map.put("one", "Three");
-        map.put(null, "Four");
-        map.put(Integer.valueOf(20), "Five");
-        final Map<Object, String> caseInsensitiveMap = new CaseInsensitiveMap<>(map);
-        assertEquals(4, caseInsensitiveMap.size()); // ones collapsed
-        final Set<Object> keys = caseInsensitiveMap.keySet();
-        assertTrue(keys.contains("one"));
-        assertTrue(keys.contains("two"));
-        assertTrue(keys.contains(null));
-        assertTrue(keys.contains(Integer.toString(20)));
-        assertEquals(4, keys.size());
-        assertTrue(!caseInsensitiveMap.containsValue("One")
-            || !caseInsensitiveMap.containsValue("Three")); // ones collapsed
-        assertEquals("Four", caseInsensitiveMap.get(null));
-    }
-
-    @SuppressWarnings("unchecked")
     public void testClone() {
         final CaseInsensitiveMap<K, V> map = new CaseInsensitiveMap<>(10);
         map.put((K) "1", (V) "1");
@@ -105,12 +69,13 @@ public class CaseInsensitiveMapTest<K, V> extends AbstractIterableMapTest<K, V>
         assertSame(map.get("1"), cloned.get("1"));
     }
 
-//    public void testCreate() throws Exception {
-//        resetEmpty();
-//        writeExternalFormToDisk((java.io.Serializable) map, "src/test/resources/data/test/CaseInsensitiveMap.emptyCollection.version4.obj");
-//        resetFull();
-//        writeExternalFormToDisk((java.io.Serializable) map, "src/test/resources/data/test/CaseInsensitiveMap.fullCollection.version4.obj");
-//    }
+    /**
+     * Test for <a href="https://issues.apache.org/jira/browse/COLLECTIONS-323">COLLECTIONS-323</a>.
+     */
+    public void testInitialCapacityZero() {
+        final CaseInsensitiveMap<String, String> map = new CaseInsensitiveMap<>(0);
+        assertEquals(1, map.data.length);
+    }
 
     // COLLECTIONS-294
     public void testLocaleIndependence() {
@@ -140,11 +105,46 @@ public class CaseInsensitiveMapTest<K, V> extends AbstractIterableMapTest<K, V>
         }
     }
 
-    /**
-     * Test for <a href="https://issues.apache.org/jira/browse/COLLECTIONS-323">COLLECTIONS-323</a>.
-     */
-    public void testInitialCapacityZero() {
-        final CaseInsensitiveMap<String, String> map = new CaseInsensitiveMap<>(0);
-        assertEquals(1, map.data.length);
+//    public void testCreate() throws Exception {
+//        resetEmpty();
+//        writeExternalFormToDisk((java.io.Serializable) map, "src/test/resources/data/test/CaseInsensitiveMap.emptyCollection.version4.obj");
+//        resetFull();
+//        writeExternalFormToDisk((java.io.Serializable) map, "src/test/resources/data/test/CaseInsensitiveMap.fullCollection.version4.obj");
+//    }
+
+    @SuppressWarnings("unchecked")
+    public void testNullHandling() {
+        final Map<K, V> map = makeObject();
+        map.put((K) "One", (V) "One");
+        map.put((K) "Two", (V) "Two");
+        map.put(null, (V) "Three");
+        assertEquals("Three", map.get(null));
+        map.put(null, (V) "Four");
+        assertEquals("Four", map.get(null));
+        final Set<K> keys = map.keySet();
+        assertTrue(keys.contains("one"));
+        assertTrue(keys.contains("two"));
+        assertTrue(keys.contains(null));
+        assertEquals(3, keys.size());
+    }
+
+    public void testPutAll() {
+        final Map<Object, String> map = new HashMap<>();
+        map.put("One", "One");
+        map.put("Two", "Two");
+        map.put("one", "Three");
+        map.put(null, "Four");
+        map.put(Integer.valueOf(20), "Five");
+        final Map<Object, String> caseInsensitiveMap = new CaseInsensitiveMap<>(map);
+        assertEquals(4, caseInsensitiveMap.size()); // ones collapsed
+        final Set<Object> keys = caseInsensitiveMap.keySet();
+        assertTrue(keys.contains("one"));
+        assertTrue(keys.contains("two"));
+        assertTrue(keys.contains(null));
+        assertTrue(keys.contains(Integer.toString(20)));
+        assertEquals(4, keys.size());
+        assertTrue(!caseInsensitiveMap.containsValue("One")
+            || !caseInsensitiveMap.containsValue("Three")); // ones collapsed
+        assertEquals("Four", caseInsensitiveMap.get(null));
     }
 }


[commons-collections] 06/06: Merge branch 'master' of https://ggregory@gitbox.apache.org/repos/asf/commons-collections

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-collections.git

commit 4a980fadc47e1983a7435ec4666763bd8bdea205
Merge: 283b1ba ba85c69
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 27 14:32:52 2020 -0500

    Merge branch 'master' of https://ggregory@gitbox.apache.org/repos/asf/commons-collections

 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)