commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r666175 - in /commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor: adapter/ core/ core/comparator/
Date Tue, 10 Jun 2008 15:59:21 GMT
Author: mbenson
Date: Tue Jun 10 08:59:20 2008
New Revision: 666175

URL: http://svn.apache.org/viewvc?rev=666175&view=rev
Log:
unchecked warnings

Modified:
    commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestBinaryPredicateBinaryFunction.java
    commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftFunction.java
    commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java
    commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java
    commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsEqual.java
    commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsInstance.java
    commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsNotEqual.java
    commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestLimit.java
    commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestOffset.java
    commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/BaseComparisonPredicateTest.java

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestBinaryPredicateBinaryFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestBinaryPredicateBinaryFunction.java?rev=666175&r1=666174&r2=666175&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestBinaryPredicateBinaryFunction.java
(original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestBinaryPredicateBinaryFunction.java
Tue Jun 10 08:59:20 2008
@@ -44,7 +44,7 @@
     // ------------------------------------------------------------------------
 
     protected Object makeFunctor() {
-        return new BinaryPredicateBinaryFunction(new Constant(true));
+        return new BinaryPredicateBinaryFunction<Object, Object>(Constant.TRUE);
     }
 
     // Lifecycle

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftFunction.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftFunction.java?rev=666175&r1=666174&r2=666175&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftFunction.java
(original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftFunction.java
Tue Jun 10 08:59:20 2008
@@ -45,7 +45,7 @@
     // ------------------------------------------------------------------------
 
     protected Object makeFunctor() {
-        return new IgnoreLeftFunction(new Constant("xyzzy"));
+        return new IgnoreLeftFunction<Object, Object, Object>(Constant.of("xyzzy"));
     }
 
     // Lifecycle

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java?rev=666175&r1=666174&r2=666175&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java
(original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreLeftPredicate.java
Tue Jun 10 08:59:20 2008
@@ -21,8 +21,6 @@
 
 import org.apache.commons.functor.BaseFunctorTest;
 import org.apache.commons.functor.BinaryPredicate;
-import org.apache.commons.functor.UnaryFunction;
-import org.apache.commons.functor.UnaryPredicate;
 import org.apache.commons.functor.core.Constant;
 import org.apache.commons.functor.core.Identity;
 
@@ -47,7 +45,7 @@
     // ------------------------------------------------------------------------
 
     protected Object makeFunctor() {
-        return new IgnoreLeftPredicate(new Constant(true));
+        return new IgnoreLeftPredicate<Object, Object>(Constant.TRUE);
     }
 
     // Lifecycle
@@ -78,7 +76,7 @@
         assertObjectsAreEqual(p,new IgnoreLeftPredicate<Object, Boolean>(
                 new UnaryFunctionUnaryPredicate<Boolean>(Identity.<Boolean> instance())));
         assertObjectsAreNotEqual(p,Constant.TRUE);
-        assertObjectsAreNotEqual(p,new IgnoreLeftPredicate(Constant.FALSE));
+        assertObjectsAreNotEqual(p,new IgnoreLeftPredicate<Object, Object>(Constant.FALSE));
         assertObjectsAreNotEqual(p,Constant.FALSE);
     }
 
@@ -87,6 +85,6 @@
     }
 
     public void testAdapt() throws Exception {
-        assertNotNull(IgnoreLeftPredicate.adapt(new Constant(true)));
+        assertNotNull(IgnoreLeftPredicate.adapt(Constant.TRUE));
     }
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java?rev=666175&r1=666174&r2=666175&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java
(original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/adapter/TestIgnoreRightPredicate.java
Tue Jun 10 08:59:20 2008
@@ -45,7 +45,7 @@
     // ------------------------------------------------------------------------
 
     protected Object makeFunctor() {
-        return new IgnoreRightPredicate(new Constant(true));
+        return new IgnoreRightPredicate<Boolean, Object>(Constant.TRUE);
     }
 
     // Lifecycle
@@ -63,18 +63,21 @@
     // ------------------------------------------------------------------------
 
     public void testEvaluate() throws Exception {
-        BinaryPredicate p = new IgnoreRightPredicate(new UnaryFunctionUnaryPredicate(new
Identity()));
+        BinaryPredicate<Boolean, Object> p = new IgnoreRightPredicate<Boolean, Object>(
+                new UnaryFunctionUnaryPredicate<Boolean>(Identity.<Boolean> instance()));
         assertTrue(p.test(Boolean.TRUE,null));
         assertTrue(!p.test(Boolean.FALSE,null));
     }
 
     public void testEquals() throws Exception {
-        BinaryPredicate p = new IgnoreRightPredicate(new UnaryFunctionUnaryPredicate(new
Identity()));
+        BinaryPredicate<Boolean, Object> p = new IgnoreRightPredicate<Boolean, Object>(
+                new UnaryFunctionUnaryPredicate<Boolean>(Identity.<Boolean> instance()));
         assertEquals(p,p);
-        assertObjectsAreEqual(p,new IgnoreRightPredicate(new UnaryFunctionUnaryPredicate(new
Identity())));
-        assertObjectsAreNotEqual(p,new Constant(true));
-        assertObjectsAreNotEqual(p,new IgnoreRightPredicate(new Constant(false)));
-        assertObjectsAreNotEqual(p,new Constant(false));
+        assertObjectsAreEqual(p,new IgnoreRightPredicate<Boolean, Object>(
+                new UnaryFunctionUnaryPredicate<Boolean>(Identity.<Boolean> instance())));
+        assertObjectsAreNotEqual(p,Constant.TRUE);
+        assertObjectsAreNotEqual(p,new IgnoreRightPredicate<Boolean, Object>(Constant.FALSE));
+        assertObjectsAreNotEqual(p,Constant.FALSE);
     }
 
     public void testAdaptNull() throws Exception {
@@ -82,6 +85,6 @@
     }
 
     public void testAdapt() throws Exception {
-        assertNotNull(IgnoreRightPredicate.adapt(new Constant(true)));
+        assertNotNull(IgnoreRightPredicate.adapt(Constant.TRUE));
     }
 }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsEqual.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsEqual.java?rev=666175&r1=666174&r2=666175&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsEqual.java
(original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsEqual.java
Tue Jun 10 08:59:20 2008
@@ -43,7 +43,7 @@
     // ------------------------------------------------------------------------
 
     protected Object makeFunctor() {
-        return new IsEqual();
+        return new IsEqual<Object, Object>();
     }
 
     // Lifecycle
@@ -61,7 +61,7 @@
     // ------------------------------------------------------------------------
 
     public void testTest() throws Exception {
-        IsEqual p = new IsEqual();
+        IsEqual<Object, Object> p = new IsEqual<Object, Object>();
         assertTrue("For symmetry, two nulls should be equal",p.test(null,null));
         assertTrue(p.test("foo","foo"));
         assertTrue(!p.test(null,"foo"));
@@ -77,10 +77,10 @@
     }
 
     public void testEquals() throws Exception {
-        BinaryPredicate f = new IsEqual();
+        BinaryPredicate<Object, Object> f = new IsEqual<Object, Object>();
         assertEquals(f,f);
 
-        assertObjectsAreEqual(f,new IsEqual());
+        assertObjectsAreEqual(f,new IsEqual<Object, Object>());
         assertObjectsAreEqual(f,IsEqual.instance());
         assertObjectsAreNotEqual(f,Constant.truePredicate());
     }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsInstance.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsInstance.java?rev=666175&r1=666174&r2=666175&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsInstance.java
(original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsInstance.java
Tue Jun 10 08:59:20 2008
@@ -62,7 +62,7 @@
     // ------------------------------------------------------------------------
 
     public void testTest() throws Exception {
-        BinaryPredicate p = IsInstance.INSTANCE;
+        BinaryPredicate<Object, Class<?>> p = IsInstance.INSTANCE;
         assertFalse(p.test(null, Number.class));
         assertFalse(p.test("foo", Number.class));
         assertTrue(p.test(3, Number.class));
@@ -70,7 +70,7 @@
     }
 
     public void testBoundTest() throws Exception {
-        UnaryPredicate p = IsInstance.of(Number.class);
+        UnaryPredicate<Object> p = IsInstance.of(Number.class);
         assertFalse(p.test(null));
         assertFalse(p.test("foo"));
         assertTrue(p.test(3));
@@ -78,7 +78,7 @@
     }
 
     public void testInstanceOfNull() throws Exception {
-        BinaryPredicate p = new IsInstance();
+        BinaryPredicate<Object, Class<?>> p = new IsInstance<Object>();
         try {
             p.test("foo", null);
             fail("Expected NullPointerException");
@@ -88,14 +88,14 @@
     }
 
     public void testEquals() throws Exception {
-        BinaryPredicate p = IsInstance.INSTANCE;
+        BinaryPredicate<Object, Class<?>> p = IsInstance.INSTANCE;
         assertEquals(p, p);
         assertObjectsAreEqual(p, IsInstance.instance());
         assertObjectsAreNotEqual(p,Constant.truePredicate());
     }
 
     public void testBoundEquals() throws Exception {
-        UnaryPredicate p = IsInstance.of(Object.class);
+        UnaryPredicate<Object> p = IsInstance.of(Object.class);
         assertEquals(p,p);
         assertObjectsAreEqual(p,IsInstance.of(Object.class));
         assertObjectsAreNotEqual(p,Constant.truePredicate());

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsNotEqual.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsNotEqual.java?rev=666175&r1=666174&r2=666175&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsNotEqual.java
(original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestIsNotEqual.java
Tue Jun 10 08:59:20 2008
@@ -61,7 +61,7 @@
     // ------------------------------------------------------------------------
 
     public void testTest() throws Exception {
-        IsNotEqual p = new IsNotEqual();
+        IsNotEqual<Object, Object> p = new IsNotEqual<Object, Object>();
         assertTrue("For symmetry, two nulls should be equal",!p.test(null,null));
         assertTrue(!p.test("foo","foo"));
         assertTrue(p.test(null,"foo"));
@@ -77,9 +77,9 @@
     }
 
     public void testEquals() throws Exception {
-        BinaryPredicate p = new IsNotEqual();
+        BinaryPredicate<Object, Object> p = new IsNotEqual<Object, Object>();
         assertEquals(p,p);
-        assertObjectsAreEqual(p,new IsNotEqual());
+        assertObjectsAreEqual(p,new IsNotEqual<Object, Object>());
         assertObjectsAreEqual(p,IsNotEqual.instance());
         assertObjectsAreNotEqual(p,Constant.truePredicate());
     }

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestLimit.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestLimit.java?rev=666175&r1=666174&r2=666175&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestLimit.java
(original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestLimit.java
Tue Jun 10 08:59:20 2008
@@ -70,7 +70,7 @@
         }
     }
 
-    public void testTestNilary() throws Exception {
+    public void testTestNullary() throws Exception {
         Predicate p = new Limit(3);
         assertTrue(p.test());
         assertTrue(p.test());
@@ -79,7 +79,7 @@
     }
 
     public void testTestUnary() throws Exception {
-        UnaryPredicate p = new Limit(3);
+        UnaryPredicate<Object> p = new Limit(3);
         assertTrue(p.test(null));
         assertTrue(p.test(null));
         assertTrue(p.test(null));
@@ -87,7 +87,7 @@
     }
 
     public void testTestBinary() throws Exception {
-        BinaryPredicate p = new Limit(3);
+        BinaryPredicate<Object, Object> p = new Limit(3);
         assertTrue(p.test(null,null));
         assertTrue(p.test(null,null));
         assertTrue(p.test(null,null));

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestOffset.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestOffset.java?rev=666175&r1=666174&r2=666175&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestOffset.java
(original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/TestOffset.java
Tue Jun 10 08:59:20 2008
@@ -70,7 +70,7 @@
         }
     }
 
-    public void testTestNilary() throws Exception {
+    public void testTestNullary() throws Exception {
         Predicate p = new Offset(3);
         assertTrue(!p.test());
         assertTrue(!p.test());
@@ -79,7 +79,7 @@
     }
 
     public void testTestUnary() throws Exception {
-        UnaryPredicate p = new Offset(3);
+        UnaryPredicate<Object> p = new Offset(3);
         assertTrue(!p.test(null));
         assertTrue(!p.test(null));
         assertTrue(!p.test(null));
@@ -87,7 +87,7 @@
     }
 
     public void testTestBinary() throws Exception {
-        BinaryPredicate p = new Offset(3);
+        BinaryPredicate<Object, Object> p = new Offset(3);
         assertTrue(!p.test(null,null));
         assertTrue(!p.test(null,null));
         assertTrue(!p.test(null,null));

Modified: commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/BaseComparisonPredicateTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/BaseComparisonPredicateTest.java?rev=666175&r1=666174&r2=666175&view=diff
==============================================================================
--- commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/BaseComparisonPredicateTest.java
(original)
+++ commons/sandbox/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/BaseComparisonPredicateTest.java
Tue Jun 10 08:59:20 2008
@@ -47,7 +47,8 @@
     // ------------------------------------------------------------------------
 
     public final void testTestNull() throws Exception {
-        BinaryPredicate p = (BinaryPredicate)(makeFunctor());
+        @SuppressWarnings("unchecked")
+        BinaryPredicate<Object, Object> p = (BinaryPredicate<Object, Object>)(makeFunctor());
         try {
             p.test(new Integer(2),null);
             fail("Expected NullPointerException");
@@ -69,7 +70,8 @@
     }
 
     public final void testTestNonComparable() throws Exception {
-        BinaryPredicate p = (BinaryPredicate)(makeFunctor());
+        @SuppressWarnings("unchecked")
+        BinaryPredicate<Object, Object> p = (BinaryPredicate<Object, Object>)(makeFunctor());
         try {
             p.test(new Integer(2),new Object());
             fail("Expected ClassCastException");



Mime
View raw message