commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1685299 [2/2] - in /commons/proper/collections/trunk/src: main/java/org/apache/commons/collections4/ main/java/org/apache/commons/collections4/multimap/ test/java/org/apache/commons/collections4/multimap/ test/resources/data/test/
Date Sat, 13 Jun 2015 18:27:12 GMT
Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java?rev=1685299&r1=1685298&r2=1685299&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/AbstractMultiValuedMapTest.java
Sat Jun 13 18:27:11 2015
@@ -192,26 +192,29 @@ public abstract class AbstractMultiValue
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testNoMappingReturnsEmptyCol() {
         final MultiValuedMap<K, V> map = makeFullMap();
-        assertTrue(map.get("whatever").isEmpty());
+        assertTrue(map.get((K) "whatever").isEmpty());
     }
 
     public void testMultipleValues() {
         final MultiValuedMap<K, V> map = makeFullMap();
-        Collection<V> col = map.get("one");
+        @SuppressWarnings("unchecked")
+        Collection<V> col = map.get((K) "one");
         assertTrue(col.contains("uno"));
         assertTrue(col.contains("un"));
     }
 
+    @SuppressWarnings("unchecked")
     public void testGet() {
         final MultiValuedMap<K, V> map = makeFullMap();
-        assertTrue(map.get("one").contains("uno"));
-        assertTrue(map.get("one").contains("un"));
-        assertTrue(map.get("two").contains("dos"));
-        assertTrue(map.get("two").contains("deux"));
-        assertTrue(map.get("three").contains("tres"));
-        assertTrue(map.get("three").contains("trois"));
+        assertTrue(map.get((K) "one").contains("uno"));
+        assertTrue(map.get((K) "one").contains("un"));
+        assertTrue(map.get((K) "two").contains("dos"));
+        assertTrue(map.get((K) "two").contains("deux"));
+        assertTrue(map.get((K) "three").contains("tres"));
+        assertTrue(map.get((K) "three").contains("trois"));
     }
 
     @SuppressWarnings("unchecked")
@@ -221,8 +224,8 @@ public abstract class AbstractMultiValue
         }
         resetEmpty();
         final MultiValuedMap<K, V> map =  getMap();
-        Collection<V> col1 = map.get("one");
-        Collection<V> col2 = map.get("one");
+        Collection<V> col1 = map.get((K) "one");
+        Collection<V> col2 = map.get((K) "one");
         assertTrue(col1.isEmpty());
         assertTrue(col2.isEmpty());
         assertEquals(0, map.size());
@@ -243,7 +246,8 @@ public abstract class AbstractMultiValue
         }
         resetFull();
         final MultiValuedMap<K, V> map = getMap();
-        Collection<V> col = map.get("one");
+        @SuppressWarnings("unchecked")
+        Collection<V> col = map.get((K) "one");
         assertEquals(2, col.size());
         assertEquals(6, map.size());
         col.remove("uno");
@@ -265,7 +269,8 @@ public abstract class AbstractMultiValue
         }
         resetFull();
         final MultiValuedMap<K, V> map = getMap();
-        Iterator<V> it = map.get("one").iterator();
+        @SuppressWarnings("unchecked")
+        Iterator<V> it = map.get((K) "one").iterator();
         while (it.hasNext()) {
             it.next();
             it.remove();
@@ -325,6 +330,7 @@ public abstract class AbstractMultiValue
 //        assertEquals(expected, actual);
 //    }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveAllViaValuesIterator() {
         if (!isRemoveSupported()) {
             return;
@@ -334,7 +340,7 @@ public abstract class AbstractMultiValue
             i.next();
             i.remove();
         }
-        assertTrue(map.get("one").isEmpty());
+        assertTrue(map.get((K) "one").isEmpty());
         assertTrue(map.isEmpty());
     }
 
@@ -392,6 +398,7 @@ public abstract class AbstractMultiValue
         }
     }
 
+    @SuppressWarnings("unchecked")
     public void testRemoveAllViaEntriesIterator() {
         if (!isRemoveSupported()) {
             return;
@@ -401,7 +408,7 @@ public abstract class AbstractMultiValue
             i.next();
             i.remove();
         }
-        assertTrue(map.get("one").isEmpty());
+        assertTrue(map.get((K) "one").isEmpty());
         assertEquals(0, map.size());
     }
 
@@ -418,7 +425,7 @@ public abstract class AbstractMultiValue
         final MultiValuedMap<K, V> one = makeObject();
         final Integer value = Integer.valueOf(1);
         one.put((K) "One", (V) value);
-        one.removeMapping((K) "One", (V) value);
+        one.removeMapping("One", value);
 
         final MultiValuedMap<K, V> two = makeObject();
         assertEquals(two, one);
@@ -441,7 +448,7 @@ public abstract class AbstractMultiValue
         assertEquals(4, map.size());
         map.remove("A");
         assertEquals(3, map.size());
-        map.removeMapping((K) "B", (V) "BC");
+        map.removeMapping("B", "BC");
         assertEquals(2, map.size());
     }
 
@@ -453,33 +460,33 @@ public abstract class AbstractMultiValue
     @SuppressWarnings("unchecked")
     public void testSize_Key() {
         final MultiValuedMap<K, V> map = makeFullMap();
-        assertEquals(2, map.get("one").size());
-        assertEquals(2, map.get("two").size());
-        assertEquals(2, map.get("three").size());
+        assertEquals(2, map.get((K) "one").size());
+        assertEquals(2, map.get((K) "two").size());
+        assertEquals(2, map.get((K) "three").size());
         if (!isAddSupported()) {
             return;
         }
         map.put((K) "A", (V) "AA");
-        assertEquals(1, map.get("A").size());
+        assertEquals(1, map.get((K) "A").size());
         //assertEquals(0, map.get("B").size());
         map.put((K) "B", (V) "BA");
-        assertEquals(1, map.get("A").size());
-        assertEquals(1, map.get("B").size());
+        assertEquals(1, map.get((K) "A").size());
+        assertEquals(1, map.get((K) "B").size());
         map.put((K) "B", (V) "BB");
-        assertEquals(1, map.get("A").size());
-        assertEquals(2, map.get("B").size());
+        assertEquals(1, map.get((K) "A").size());
+        assertEquals(2, map.get((K) "B").size());
         map.put((K) "B", (V) "BC");
-        assertEquals(1, map.get("A").size());
-        assertEquals(3, map.get("B").size());
+        assertEquals(1, map.get((K) "A").size());
+        assertEquals(3, map.get((K) "B").size());
         if (!isRemoveSupported()) {
             return;
         }
         map.remove("A");
         //assertEquals(0, map.get("A").size());
-        assertEquals(3, map.get("B").size());
-        map.removeMapping((K) "B", (V) "BC");
+        assertEquals(3, map.get((K) "B").size());
+        map.removeMapping("B", "BC");
         //assertEquals(0, map.get("A").size());
-        assertEquals(2, map.get("B").size());
+        assertEquals(2, map.get((K) "B").size());
     }
 
 //    @SuppressWarnings("unchecked")
@@ -534,8 +541,8 @@ public abstract class AbstractMultiValue
 
         assertEquals(2, test.keySet().size());
         assertEquals(4, test.size());
-        assertEquals(1, test.get("keyA").size());
-        assertEquals(3, test.get("key").size());
+        assertEquals(1, test.get((K) "keyA").size());
+        assertEquals(3, test.get((K) "key").size());
         assertEquals(true, test.containsValue("objectA"));
         assertEquals(true, test.containsValue("object0"));
         assertEquals(true, test.containsValue("object1"));
@@ -558,9 +565,9 @@ public abstract class AbstractMultiValue
 
         assertEquals(3, test.keySet().size());
         assertEquals(4, test.size());
-        assertEquals(1, test.get("keyA").size());
-        assertEquals(2, test.get("keyX").size());
-        assertEquals(1, test.get("keyY").size());
+        assertEquals(1, test.get((K) "keyA").size());
+        assertEquals(2, test.get((K) "keyX").size());
+        assertEquals(1, test.get((K) "keyY").size());
         assertEquals(true, test.containsValue("objectA"));
         assertEquals(true, test.containsValue("object0"));
         assertEquals(true, test.containsValue("object1"));
@@ -576,7 +583,7 @@ public abstract class AbstractMultiValue
         Collection<V> coll = (Collection<V>) Arrays.asList("X", "Y", "Z");
 
         assertEquals(true, map.putAll((K) "A", coll));
-        assertEquals(3, map.get("A").size());
+        assertEquals(3, map.get((K) "A").size());
         assertEquals(true, map.containsMapping("A", "X"));
         assertEquals(true, map.containsMapping("A", "Y"));
         assertEquals(true, map.containsMapping("A", "Z"));
@@ -588,20 +595,20 @@ public abstract class AbstractMultiValue
             // expected
         }
 
-        assertEquals(3, map.get("A").size());
+        assertEquals(3, map.get((K) "A").size());
         assertEquals(true, map.containsMapping("A", "X"));
         assertEquals(true, map.containsMapping("A", "Y"));
         assertEquals(true, map.containsMapping("A", "Z"));
 
         assertEquals(false, map.putAll((K) "A", new ArrayList<V>()));
-        assertEquals(3, map.get("A").size());
+        assertEquals(3, map.get((K) "A").size());
         assertEquals(true, map.containsMapping("A", "X"));
         assertEquals(true, map.containsMapping("A", "Y"));
         assertEquals(true, map.containsMapping("A", "Z"));
 
         coll = (Collection<V>) Arrays.asList("M");
         assertEquals(true, map.putAll((K) "A", coll));
-        assertEquals(4, map.get("A").size());
+        assertEquals(4, map.get((K) "A").size());
         assertEquals(true, map.containsMapping("A", "X"));
         assertEquals(true, map.containsMapping("A", "Y"));
         assertEquals(true, map.containsMapping("A", "Z"));
@@ -617,11 +624,11 @@ public abstract class AbstractMultiValue
         map.put((K) "A", (V) "AA");
         map.put((K) "A", (V) "AB");
         map.put((K) "A", (V) "AC");
-        assertEquals(false, map.removeMapping((K) "C", (V) "CA"));
-        assertEquals(false, map.removeMapping((K) "A", (V) "AD"));
-        assertEquals(true, map.removeMapping((K) "A", (V) "AC"));
-        assertEquals(true, map.removeMapping((K) "A", (V) "AB"));
-        assertEquals(true, map.removeMapping((K) "A", (V) "AA"));
+        assertEquals(false, map.removeMapping("C", "CA"));
+        assertEquals(false, map.removeMapping("A", "AD"));
+        assertEquals(true, map.removeMapping("A", "AC"));
+        assertEquals(true, map.removeMapping("A", "AB"));
+        assertEquals(true, map.removeMapping("A", "AA"));
         //assertEquals(new MultiValuedHashMap<K, V>(), map);
     }
 
@@ -756,13 +763,15 @@ public abstract class AbstractMultiValue
         assertEquals("Map is empty", 0, map2.size());
     }
 
+    @SuppressWarnings({ "rawtypes", "unchecked" })
     public void testFullMapCompatibility() throws Exception {
-        final MultiValuedMap<?, ?> map = makeFullMap();
-        final MultiValuedMap<?, ?> map2 =
-                (MultiValuedMap<?, ?>) readExternalFormFromDisk(getCanonicalFullCollectionName(map));
+        final MultiValuedMap map = makeFullMap();
+        final MultiValuedMap map2 =
+                (MultiValuedMap) readExternalFormFromDisk(getCanonicalFullCollectionName(map));
         assertEquals("Map is the right size", map.size(), map2.size());
         for (final Object key : map.keySet()) {
-            assertTrue("Map had inequal elements", CollectionUtils.isEqualCollection(map.get(key),
map2.get(key)));
+            assertTrue("Map had inequal elements",
+                       CollectionUtils.isEqualCollection(map.get(key), map2.get(key)));
             if (isRemoveSupported()) {
                 map2.remove(key);
             }

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/MultiValuedHashMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/MultiValuedHashMapTest.java?rev=1685299&r1=1685298&r2=1685299&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/MultiValuedHashMapTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/MultiValuedHashMapTest.java
Sat Jun 13 18:27:11 2015
@@ -53,9 +53,9 @@ public class MultiValuedHashMapTest<K, V
     @SuppressWarnings("unchecked")
     public void testSetValuedMapAdd() {
         final SetValuedMap<K, V> setMap = MultiValuedHashMap.setValuedHashMap();
-        assertTrue(setMap.get("whatever") instanceof Set);
+        assertTrue(setMap.get((K) "whatever") instanceof Set);
 
-        Set<V> set = setMap.get("A");
+        Set<V> set = setMap.get((K) "A");
         assertTrue(set.add((V) "a1"));
         assertTrue(set.add((V) "a2"));
         assertFalse(set.add((V) "a1"));
@@ -66,9 +66,9 @@ public class MultiValuedHashMapTest<K, V
     @SuppressWarnings("unchecked")
     public void testSetValuedMapRemove() {
         final SetValuedMap<K, V> setMap = MultiValuedHashMap.setValuedHashMap();
-        assertTrue(setMap.get("whatever") instanceof Set);
+        assertTrue(setMap.get((K) "whatever") instanceof Set);
 
-        Set<V> set = setMap.get("A");
+        Set<V> set = setMap.get((K) "A");
         assertTrue(set.add((V) "a1"));
         assertTrue(set.add((V) "a2"));
         assertFalse(set.add((V) "a1"));
@@ -86,9 +86,9 @@ public class MultiValuedHashMapTest<K, V
     @SuppressWarnings("unchecked")
     public void testSetValuedMapRemoveViaIterator() {
         final SetValuedMap<K, V> setMap = MultiValuedHashMap.setValuedHashMap();
-        assertTrue(setMap.get("whatever") instanceof Set);
+        assertTrue(setMap.get((K) "whatever") instanceof Set);
 
-        Set<V> set = setMap.get("A");
+        Set<V> set = setMap.get((K) "A");
         set.add((V) "a1");
         set.add((V) "a2");
         set.add((V) "a1");
@@ -105,8 +105,8 @@ public class MultiValuedHashMapTest<K, V
     @SuppressWarnings("unchecked")
     public void testListValuedMapAdd() {
         final ListValuedMap<K, V> listMap = MultiValuedHashMap.listValuedHashMap();
-        assertTrue(listMap.get("whatever") instanceof List);
-        List<V> list = listMap.get("A");
+        assertTrue(listMap.get((K) "whatever") instanceof List);
+        List<V> list = listMap.get((K) "A");
         list.add((V) "a1");
         assertEquals(1, listMap.size());
         assertTrue(listMap.containsKey("A"));
@@ -115,7 +115,7 @@ public class MultiValuedHashMapTest<K, V
     @SuppressWarnings("unchecked")
     public void testListValuedMapAddViaListIterator() {
         final ListValuedMap<K, V> listMap = MultiValuedHashMap.listValuedHashMap();
-        ListIterator<V> listIt = listMap.get("B").listIterator();
+        ListIterator<V> listIt = listMap.get((K) "B").listIterator();
         assertFalse(listIt.hasNext());
         listIt.add((V) "b1");
         listIt.add((V) "b2");
@@ -129,7 +129,7 @@ public class MultiValuedHashMapTest<K, V
     @SuppressWarnings("unchecked")
     public void testListValuedMapRemove() {
         final ListValuedMap<K, V> listMap = MultiValuedHashMap.listValuedHashMap();
-        List<V> list = listMap.get("A");
+        List<V> list = listMap.get((K) "A");
         list.add((V) "a1");
         list.add((V) "a2");
         list.add((V) "a3");
@@ -146,12 +146,12 @@ public class MultiValuedHashMapTest<K, V
     @SuppressWarnings("unchecked")
     public void testListValuedMapRemoveViaListIterator() {
         final ListValuedMap<K, V> listMap = MultiValuedHashMap.listValuedHashMap();
-        ListIterator<V> listIt = listMap.get("B").listIterator();
+        ListIterator<V> listIt = listMap.get((K) "B").listIterator();
         listIt.add((V) "b1");
         listIt.add((V) "b2");
         assertEquals(2, listMap.size());
         assertTrue(listMap.containsKey("B"));
-        listIt = listMap.get("B").listIterator();
+        listIt = listMap.get((K) "B").listIterator();
         while (listIt.hasNext()) {
             listIt.next();
             listIt.remove();
@@ -160,7 +160,7 @@ public class MultiValuedHashMapTest<K, V
         listIt.add((V) "b1");
         listIt.add((V) "b2");
         assertTrue(listMap.containsKey("B"));
-        assertEquals(2, listMap.get("B").size());
+        assertEquals(2, listMap.get((K) "B").size());
     }
 
     @SuppressWarnings({ "unchecked", "rawtypes" })
@@ -170,8 +170,8 @@ public class MultiValuedHashMapTest<K, V
 
         map1.put("a", "a1");
         map1.put("a", "a2");
-        map2.put("a", "a2");
         map2.put("a", "a1");
+        map2.put("a", "a2");
         assertEquals(map1, map2);
         assertEquals(map1.hashCode(), map2.hashCode());
 

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java?rev=1685299&r1=1685298&r2=1685299&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections4/multimap/TransformedMultiValuedMapTest.java
Sat Jun 13 18:27:11 2015
@@ -63,7 +63,7 @@ public class TransformedMultiValuedMapTe
             assertEquals(true, map.containsKey(Integer.valueOf((String) els[i])));
             assertEquals(false, map.containsKey(els[i]));
             assertEquals(true, map.containsValue(els[i]));
-            assertEquals(true, map.get(Integer.valueOf((String) els[i])).contains(els[i]));
+            assertEquals(true, map.get((K) Integer.valueOf((String) els[i])).contains(els[i]));
         }
 
         Collection<V> coll = map.remove(els[0]);
@@ -86,7 +86,7 @@ public class TransformedMultiValuedMapTe
             assertEquals(true, map.containsValue(Integer.valueOf((String) els[i])));
             assertEquals(false, map.containsValue(els[i]));
             assertEquals(true, map.containsKey(els[i]));
-            assertEquals(true, map.get(els[i]).contains(Integer.valueOf((String) els[i])));
+            assertEquals(true, map.get((K) els[i]).contains(Integer.valueOf((String) els[i])));
         }
         assertEquals(true, map.remove(els[0]).contains(Integer.valueOf((String) els[0])));
     }
@@ -105,11 +105,11 @@ public class TransformedMultiValuedMapTe
                         null,
                         (Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(3, trans.size());
-        assertEquals(true, trans.get("A").contains("1"));
-        assertEquals(true, trans.get("B").contains("2"));
-        assertEquals(true, trans.get("C").contains("3"));
+        assertEquals(true, trans.get((K) "A").contains("1"));
+        assertEquals(true, trans.get((K) "B").contains("2"));
+        assertEquals(true, trans.get((K) "C").contains("3"));
         trans.put((K) "D", (V) "4");
-        assertEquals(true, trans.get("D").contains(Integer.valueOf(4)));
+        assertEquals(true, trans.get((K) "D").contains(Integer.valueOf(4)));
     }
 
     @SuppressWarnings("unchecked")
@@ -125,11 +125,11 @@ public class TransformedMultiValuedMapTe
                         null,
                         (Transformer<? super V, ? extends V>) TransformedCollectionTest.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(3, trans.size());
-        assertEquals(true, trans.get("A").contains(Integer.valueOf(1)));
-        assertEquals(true, trans.get("B").contains(Integer.valueOf(2)));
-        assertEquals(true, trans.get("C").contains(Integer.valueOf(3)));
+        assertEquals(true, trans.get((K) "A").contains(Integer.valueOf(1)));
+        assertEquals(true, trans.get((K) "B").contains(Integer.valueOf(2)));
+        assertEquals(true, trans.get((K) "C").contains(Integer.valueOf(3)));
         trans.put((K) "D", (V) "4");
-        assertEquals(true, trans.get("D").contains(Integer.valueOf(4)));
+        assertEquals(true, trans.get((K) "D").contains(Integer.valueOf(4)));
     }
 
 //    public void testCreate() throws Exception {

Modified: commons/proper/collections/trunk/src/test/resources/data/test/MultiValuedHashMap.emptyCollection.version4.1.obj
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/resources/data/test/MultiValuedHashMap.emptyCollection.version4.1.obj?rev=1685299&r1=1685298&r2=1685299&view=diff
==============================================================================
Binary files - no diff available.

Modified: commons/proper/collections/trunk/src/test/resources/data/test/MultiValuedHashMap.fullCollection.version4.1.obj
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/resources/data/test/MultiValuedHashMap.fullCollection.version4.1.obj?rev=1685299&r1=1685298&r2=1685299&view=diff
==============================================================================
Binary files - no diff available.

Modified: commons/proper/collections/trunk/src/test/resources/data/test/TransformedMultiValuedMap.emptyCollection.version4.1.obj
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/resources/data/test/TransformedMultiValuedMap.emptyCollection.version4.1.obj?rev=1685299&r1=1685298&r2=1685299&view=diff
==============================================================================
Binary files - no diff available.

Modified: commons/proper/collections/trunk/src/test/resources/data/test/TransformedMultiValuedMap.fullCollection.version4.1.obj
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/resources/data/test/TransformedMultiValuedMap.fullCollection.version4.1.obj?rev=1685299&r1=1685298&r2=1685299&view=diff
==============================================================================
Binary files - no diff available.

Modified: commons/proper/collections/trunk/src/test/resources/data/test/UnmodifiableMultiValuedMap.emptyCollection.version4.1.obj
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/resources/data/test/UnmodifiableMultiValuedMap.emptyCollection.version4.1.obj?rev=1685299&r1=1685298&r2=1685299&view=diff
==============================================================================
Binary files - no diff available.

Modified: commons/proper/collections/trunk/src/test/resources/data/test/UnmodifiableMultiValuedMap.fullCollection.version4.1.obj
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/resources/data/test/UnmodifiableMultiValuedMap.fullCollection.version4.1.obj?rev=1685299&r1=1685298&r2=1685299&view=diff
==============================================================================
Binary files - no diff available.



Mime
View raw message