commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1188409 - in /commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection: TestIsEmpty.java TestSize.java
Date Mon, 24 Oct 2011 22:02:49 GMT
Author: sebb
Date: Mon Oct 24 22:02:49 2011
New Revision: 1188409

URL: http://svn.apache.org/viewvc?rev=1188409&view=rev
Log:
Generics

Modified:
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestIsEmpty.java
    commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestSize.java

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestIsEmpty.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestIsEmpty.java?rev=1188409&r1=1188408&r2=1188409&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestIsEmpty.java
(original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestIsEmpty.java
Mon Oct 24 22:02:49 2011
@@ -37,7 +37,6 @@ import org.junit.Test;
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-@SuppressWarnings("unchecked")
 public class TestIsEmpty extends BaseFunctorTest {
 
     // Functor Testing Framework
@@ -45,7 +44,7 @@ public class TestIsEmpty extends BaseFun
 
     @Override
     protected Object makeFunctor() {
-        return new IsEmpty();
+        return new IsEmpty<Object>();
     }
 
     // Tests
@@ -56,13 +55,13 @@ public class TestIsEmpty extends BaseFun
         assertTrue(IsEmpty.instance().test(Collections.EMPTY_LIST));
         assertTrue(IsEmpty.instance().test(Collections.EMPTY_SET));
         {
-            List list = new ArrayList();
+            List<String> list = new ArrayList<String>();
             assertTrue(IsEmpty.instance().test(list));
             list.add("Xyzzy");
             assertTrue(!IsEmpty.instance().test(list));
         }
         {
-            Set set = new HashSet();
+            Set<String> set = new HashSet<String>();
             assertTrue(IsEmpty.instance().test(set));
             set.add("Xyzzy");
             assertTrue(!IsEmpty.instance().test(set));
@@ -105,7 +104,7 @@ public class TestIsEmpty extends BaseFun
 
     @Test
     public void testTestMap() throws Exception {
-        Map map = new HashMap();
+        Map<String, String> map = new HashMap<String, String>();
         assertTrue(IsEmpty.instance().test(map));
         map.put("x","y");
         assertTrue(! IsEmpty.instance().test(map));
@@ -113,11 +112,11 @@ public class TestIsEmpty extends BaseFun
 
     @Test
     public void testEquals() throws Exception {
-        UnaryPredicate p = new IsEmpty();
+        UnaryPredicate<String> p = new IsEmpty<String>();
         assertEquals(p,p);
-        assertObjectsAreEqual(p,new IsEmpty());
+        assertObjectsAreEqual(p,new IsEmpty<Long>());
         assertObjectsAreEqual(p,IsEmpty.instance());
-        assertObjectsAreNotEqual(p,new Constant(Boolean.TRUE));
+        assertObjectsAreNotEqual(p,new Constant<Boolean>(Boolean.TRUE));
     }
 
 }

Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestSize.java
URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestSize.java?rev=1188409&r1=1188408&r2=1188409&view=diff
==============================================================================
--- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestSize.java
(original)
+++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/collection/TestSize.java
Mon Oct 24 22:02:49 2011
@@ -36,14 +36,14 @@ import org.junit.Test;
  * @version $Revision$ $Date$
  * @author Rodney Waldhoff
  */
-@SuppressWarnings("unchecked")
 public class TestSize extends BaseFunctorTest {
 
     // Functor Testing Framework
     // ------------------------------------------------------------------------
 
+    @Override
     protected Object makeFunctor() {
-        return new Size();
+        return new Size<Object>();
     }
 
     // Tests
@@ -54,7 +54,7 @@ public class TestSize extends BaseFuncto
         assertEquals(new Integer(0),Size.instance().evaluate(Collections.EMPTY_LIST));
         assertEquals(new Integer(0),Size.instance().evaluate(Collections.EMPTY_SET));
         {
-            List list = new ArrayList();
+            List<Integer> list = new ArrayList<Integer>();
             assertEquals(new Integer(0),Size.instance().evaluate(list));
             for (int i=0;i<2;i++) {
                 assertEquals(new Integer(i),Size.instance().evaluate(list));
@@ -63,7 +63,7 @@ public class TestSize extends BaseFuncto
             }
         }
         {
-            Set set = new HashSet();
+            Set<Integer> set = new HashSet<Integer>();
             assertEquals(new Integer(0),Size.instance().evaluate(set));
             for (int i=0;i<2;i++) {
                 assertEquals(new Integer(i),Size.instance().evaluate(set));
@@ -106,13 +106,13 @@ public class TestSize extends BaseFuncto
 
     @Test
     public void testEquals() throws Exception {
-        UnaryFunction f = new Size();
+        UnaryFunction<Object, Integer> f = new Size<Object>();
         assertEquals(f,f);
-        assertObjectsAreEqual(f,new Size());
+        assertObjectsAreEqual(f,new Size<Object>());
         assertObjectsAreEqual(f,Size.instance());
         assertSame(Size.instance(),Size.instance());
-        assertObjectsAreNotEqual(f,new Constant(null));
-        assertTrue(! f.equals((Size) null) );
+        assertObjectsAreNotEqual(f,new Constant<Object>(null));
+        assertTrue(! f.equals((Size<?>) null) );
     }
 
 }



Mime
View raw message