commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1366807 - /commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java
Date Sun, 29 Jul 2012 10:37:03 GMT
Author: tn
Date: Sun Jul 29 10:37:03 2012
New Revision: 1366807

URL: http://svn.apache.org/viewvc?rev=1366807&view=rev
Log:
Fixed generics testcase.

Modified:
    commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java

Modified: commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java?rev=1366807&r1=1366806&r2=1366807&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java
(original)
+++ commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/bag/TransformedBagTest.java
Sun Jul 29 10:37:03 2012
@@ -36,13 +36,15 @@ public class TransformedBagTest<T> exten
     @Override
     @SuppressWarnings("unchecked")
     public Bag<T> makeObject() {
-        return TransformedBag.transformingBag(new HashBag<T>(), (Transformer<T,
T>) TestTransformedCollection.NOOP_TRANSFORMER);
+        return TransformedBag.transformingBag(new HashBag<T>(),
+                (Transformer<T, T>) TestTransformedCollection.NOOP_TRANSFORMER);
     }
 
     @SuppressWarnings("unchecked")
     public void testTransformedBag() {
         //T had better be Object!
-        Bag<T> bag = TransformedBag.transformingBag(new HashBag<T>(), (Transformer<T,
T>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        Bag<T> bag = TransformedBag.transformingBag(new HashBag<T>(),
+                (Transformer<T, T>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(0, bag.size());
         Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
         for (int i = 0; i < els.length; i++) {
@@ -56,14 +58,15 @@ public class TransformedBagTest<T> exten
         assertEquals(true, bag.remove(new Integer((String) els[0])));
     }
 
-    // TODO: Generics
+    @SuppressWarnings("unchecked")
     public void testTransformedBag_decorateTransform() {
-        Bag originalBag = new HashBag();
+        Bag<T> originalBag = new HashBag<T>();
         Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
         for (int i = 0; i < els.length; i++) {
-            originalBag.add(els[i]);
+            originalBag.add((T) els[i]);
         }
-        Bag bag = TransformedBag.transformedBag(originalBag, TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
+        Bag<T> bag = TransformedBag.transformedBag(originalBag,
+                (Transformer<T, T>) TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
         assertEquals(els.length, bag.size());
         for (int i = 0; i < els.length; i++) {
             assertEquals(true, bag.contains(new Integer((String) els[i])));



Mime
View raw message