commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Benson <gudnabr...@gmail.com>
Subject Re: svn commit: r1364676 - in /commons/proper/functor/trunk/src: changes/ main/java/org/apache/commons/functor/core/comparator/ test/java/org/apache/commons/functor/core/comparator/
Date Sat, 28 Jul 2012 16:13:03 GMT
On Fri, Jul 27, 2012 at 9:40 PM, sebb <sebbaz@gmail.com> wrote:
> On 23 July 2012 16:21,  <kinow@apache.org> wrote:
>> Author: kinow
>> Date: Mon Jul 23 15:21:25 2012
>> New Revision: 1364676
>>
>> URL: http://svn.apache.org/viewvc?rev=1364676&view=rev
>> Log:
>> [FUNCTOR-22] Added generics to ComparableComparator. Few other classes that used
the ComparableComparator were updated too. Tests were also updated accordingly.
>>
>> Modified:
>>     commons/proper/functor/trunk/src/changes/changes.xml
>>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java
>>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java
>>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java
>>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java
>>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java
>>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java
>>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java
>>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java
>>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java
>>     commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java
>>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparableComparator.java
>>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparatorFunction.java
>>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsEquivalent.java
>>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsGreaterThan.java
>>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsGreaterThanOrEqual.java
>>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsLessThan.java
>>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsLessThanOrEqual.java
>>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsNotEquivalent.java
>>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestMax.java
>>     commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestMin.java
>>
>> Modified: commons/proper/functor/trunk/src/changes/changes.xml
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/changes/changes.xml?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/changes/changes.xml (original)
>> +++ commons/proper/functor/trunk/src/changes/changes.xml Mon Jul 23 15:21:25 2012
>> @@ -23,6 +23,9 @@
>>    </properties>
>>    <body>
>>      <release version="1.0" date="2012-??-??" description="First release.">
>> +      <action dev="kinow" issue="FUNCTOR-22">
>> +        Generify ComparableComparator.
>> +      </action>
>>        <action dev="kinow" issue="FUNCTOR-3">
>>          Reduce the use of raw types in test classes.
>>        </action>
>>
>> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java
(original)
>> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparableComparator.java
Mon Jul 23 15:21:25 2012
>> @@ -20,33 +20,37 @@ import java.io.Serializable;
>>  import java.util.Comparator;
>>
>>  /**
>> - * See Commons-Collections for a public version
>> - * of this class.
>> + * A {@link Comparator Comparator} that compares {@link Comparable Comparable}
>> + * objects.
>> + * <p>
>> + * This class was created based on commons-collection's ComparableComparator.
>>   *
>> + * @param <E> the comparable type
>>   * @version $Revision$ $Date$
>>   */
>> -@SuppressWarnings({ "unchecked", "rawtypes" })
>> -final class ComparableComparator implements Comparator, Serializable {
>> +final class ComparableComparator<E extends Comparable<? super E>> implements
Comparator<E>, Serializable {
>>
>>      /** Singleton. */
>> -    public static final ComparableComparator INSTANCE = new ComparableComparator();
>> +    @SuppressWarnings("rawtypes")
>> +    public static final ComparableComparator<?> INSTANCE = new ComparableComparator();
>>
>>      /**
>>       * serialVersionUID declaration.
>>       */
>> -    private static final long serialVersionUID = -5849476573719561212L;
>> +    private static final long serialVersionUID = 9098756963321230038L;
>>
>>      /**
>>       * Create a new ComparableComparator.
>>       */
>>      public ComparableComparator() {
>> +        super();
>>      }
>>
>>      /**
>>       * {@inheritDoc}
>>       */
>> -    public int compare(Object o1, Object o2) {
>> -        return ((Comparable) o1).compareTo(o2);
>> +    public int compare(E o1, E o2) {
>> +        return o1.compareTo(o2);
>>      }
>>
>>      /**
>> @@ -75,10 +79,12 @@ final class ComparableComparator impleme
>>
>>      /**
>>       * Get a ComparableComparator instance.
>> +     * @param <E> the comparable type
>>       * @return ComparableComparator
>>       */
>> -    public static ComparableComparator instance() {
>> -        return INSTANCE;
>> +    @SuppressWarnings("unchecked")
>
> Why is it safe to ignore the unchecked warning?
>
> Please add inline comment to explain.
>
> Similarly elsewhere.
>

Also on that subject:  where possible/practical, it's nice to minimize
the scope of the suppressed warning, even if that means e.g. declaring
a local variable you wouldn't otherwise have done.

br,
Matt

>> +    public static <E extends Comparable<? super E>> ComparableComparator<E>
instance() {
>> +        return (ComparableComparator<E>) INSTANCE;
>>      }
>>
>>  }
>>
>> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java
(original)
>> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/ComparatorFunction.java
Mon Jul 23 15:21:25 2012
>> @@ -102,6 +102,6 @@ public final class ComparatorFunction<T>
>>       */
>>      @SuppressWarnings("unchecked")
>>      public static <T> ComparatorFunction<T> instance() {
>> -        return new ComparatorFunction<T>(ComparableComparator.INSTANCE);
>> +        return new ComparatorFunction<T>((Comparator<? super T>) ComparableComparator.INSTANCE);
>>      }
>>  }
>>
>> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java
(original)
>> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsEquivalent.java
Mon Jul 23 15:21:25 2012
>> @@ -45,7 +45,7 @@ public final class IsEquivalent<T> imple
>>      /**
>>       * serialVersionUID declaration.
>>       */
>> -    private static final long serialVersionUID = -6392784113015793664L;
>> +    private static final long serialVersionUID = 1884411899682486777L;
>>
>>      /**
>>       * The wrapped comparator.
>> @@ -57,7 +57,7 @@ public final class IsEquivalent<T> imple
>>       */
>>      @SuppressWarnings("unchecked")
>>      public IsEquivalent() {
>> -        this(ComparableComparator.INSTANCE);
>> +        this((Comparator<? super T>) ComparableComparator.INSTANCE);
>>      }
>>
>>      /**
>> @@ -132,7 +132,7 @@ public final class IsEquivalent<T> imple
>>       */
>>      @SuppressWarnings("unchecked")
>>      public static <T extends Comparable<?>> IsEquivalent<T> instance()
{
>> -        return new IsEquivalent<T>(ComparableComparator.INSTANCE);
>> +        return new IsEquivalent<T>((Comparator<? super T>) ComparableComparator.INSTANCE);
>>      }
>>
>>      /**
>>
>> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java
(original)
>> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThan.java
Mon Jul 23 15:21:25 2012
>> @@ -44,7 +44,7 @@ public final class IsGreaterThan<T> impl
>>      /**
>>       * serialVersionUID declaration.
>>       */
>> -    private static final long serialVersionUID = -8592932496891910273L;
>> +    private static final long serialVersionUID = 377027098765821021L;
>>
>>      /**
>>       * The wrapped comparator.
>> @@ -57,7 +57,7 @@ public final class IsGreaterThan<T> impl
>>       */
>>      @SuppressWarnings("unchecked")
>>      public IsGreaterThan() {
>> -        this(ComparableComparator.INSTANCE);
>> +        this((Comparator<? super T>) ComparableComparator.INSTANCE);
>>      }
>>
>>      /**
>>
>> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java
(original)
>> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsGreaterThanOrEqual.java
Mon Jul 23 15:21:25 2012
>> @@ -45,7 +45,7 @@ public final class IsGreaterThanOrEqual<
>>      /**
>>       * serialVersionUID declaration.
>>       */
>> -    private static final long serialVersionUID = 5262405026444050167L;
>> +    private static final long serialVersionUID = 1550544203070228570L;
>>
>>      /**
>>       * The wrapped comparator.
>> @@ -58,7 +58,7 @@ public final class IsGreaterThanOrEqual<
>>       */
>>      @SuppressWarnings("unchecked")
>>      public IsGreaterThanOrEqual() {
>> -        this(ComparableComparator.INSTANCE);
>> +        this((Comparator<? super T>) ComparableComparator.INSTANCE);
>>      }
>>
>>      /**
>>
>> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java
(original)
>> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThan.java
Mon Jul 23 15:21:25 2012
>> @@ -44,7 +44,7 @@ public final class IsLessThan<T> impleme
>>      /**
>>       * serialVersionUID declaration.
>>       */
>> -    private static final long serialVersionUID = 1809153179639613842L;
>> +    private static final long serialVersionUID = 6948263958172180877L;;
>>
>>      /**
>>       * The wrapped comparator.
>> @@ -57,7 +57,7 @@ public final class IsLessThan<T> impleme
>>       */
>>      @SuppressWarnings("unchecked")
>>      public IsLessThan() {
>> -        this(ComparableComparator.INSTANCE);
>> +        this((Comparator<? super T>) ComparableComparator.INSTANCE);
>>      }
>>
>>      /**
>>
>> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java
(original)
>> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsLessThanOrEqual.java
Mon Jul 23 15:21:25 2012
>> @@ -44,7 +44,7 @@ public final class IsLessThanOrEqual<T>
>>      /**
>>       * serialVersionUID declaration.
>>       */
>> -    private static final long serialVersionUID = -7270189005780457145L;
>> +    private static final long serialVersionUID = -5791636848361450563L;
>>
>>      /**
>>       * The wrapped comparator.
>> @@ -57,7 +57,7 @@ public final class IsLessThanOrEqual<T>
>>       */
>>      @SuppressWarnings("unchecked")
>>      public IsLessThanOrEqual() {
>> -        this(ComparableComparator.INSTANCE);
>> +        this((Comparator<? super T>) ComparableComparator.INSTANCE);
>>      }
>>
>>      /**
>>
>> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java
(original)
>> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/IsNotEquivalent.java
Mon Jul 23 15:21:25 2012
>> @@ -57,7 +57,7 @@ public final class IsNotEquivalent<T> im
>>       */
>>      @SuppressWarnings("unchecked")
>>      public IsNotEquivalent() {
>> -        this(ComparableComparator.INSTANCE);
>> +        this((Comparator<? super T>) ComparableComparator.INSTANCE);
>>      }
>>
>>      /**
>> @@ -132,7 +132,7 @@ public final class IsNotEquivalent<T> im
>>       */
>>      @SuppressWarnings("unchecked")
>>      public static <T extends Comparable<?>> IsNotEquivalent<T>
instance() {
>> -        return new IsNotEquivalent<T>(ComparableComparator.INSTANCE);
>> +        return new IsNotEquivalent<T>((Comparator<? super T>) ComparableComparator.INSTANCE);
>>      }
>>
>>      /**
>>
>> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java
(original)
>> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Max.java
Mon Jul 23 15:21:25 2012
>> @@ -53,7 +53,7 @@ public final class Max<T> implements Bin
>>       */
>>      @SuppressWarnings("unchecked")
>>      public Max() {
>> -        this(ComparableComparator.instance());
>> +        this((Comparator<T>) ComparableComparator.INSTANCE);
>>      }
>>
>>      /**
>>
>> Modified: commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java
(original)
>> +++ commons/proper/functor/trunk/src/main/java/org/apache/commons/functor/core/comparator/Min.java
Mon Jul 23 15:21:25 2012
>> @@ -41,7 +41,7 @@ public final class Min<T> implements Bin
>>      /**
>>       * serialVersionUID declaration.
>>       */
>> -    private static final long serialVersionUID = 9190170976707323848L;
>> +    private static final long serialVersionUID = -3538911698805767997L;
>>
>>      /**
>>       * The wrapped comparator.
>> @@ -53,7 +53,7 @@ public final class Min<T> implements Bin
>>       */
>>      @SuppressWarnings("unchecked")
>>      public Min() {
>> -        this(ComparableComparator.instance());
>> +        this((Comparator<T>) ComparableComparator.INSTANCE);
>>      }
>>
>>      /**
>>
>> Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparableComparator.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparableComparator.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparableComparator.java
(original)
>> +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparableComparator.java
Mon Jul 23 15:21:25 2012
>> @@ -18,7 +18,6 @@ package org.apache.commons.functor.core.
>>
>>  import static org.junit.Assert.assertEquals;
>>  import static org.junit.Assert.assertTrue;
>> -import static org.junit.Assert.fail;
>>
>>  import org.junit.Test;
>>
>> @@ -32,37 +31,22 @@ public class TestComparableComparator {
>>
>>      @Test
>>      public void testCompareIntegers() {
>> -        assertTrue(ComparableComparator.instance().compare(new Integer(Integer.MIN_VALUE),new
Integer(Integer.MIN_VALUE)) == 0);
>> -        assertTrue(ComparableComparator.instance().compare(new Integer(-1),new Integer(-1))
== 0);
>> -        assertTrue(ComparableComparator.instance().compare(new Integer(0),new Integer(0))
== 0);
>> -        assertTrue(ComparableComparator.instance().compare(new Integer(Integer.MAX_VALUE),new
Integer(Integer.MAX_VALUE)) == 0);
>> -        assertTrue(ComparableComparator.instance().compare(new Integer(1),new Integer(1))
== 0);
>> +        assertTrue(ComparableComparator.<Integer>instance().compare(new Integer(Integer.MIN_VALUE),new
Integer(Integer.MIN_VALUE)) == 0);
>> +        assertTrue(ComparableComparator.<Integer>instance().compare(new Integer(-1),new
Integer(-1)) == 0);
>> +        assertTrue(ComparableComparator.<Integer>instance().compare(new Integer(0),new
Integer(0)) == 0);
>> +        assertTrue(ComparableComparator.<Integer>instance().compare(new Integer(Integer.MAX_VALUE),new
Integer(Integer.MAX_VALUE)) == 0);
>> +        assertTrue(ComparableComparator.<Integer>instance().compare(new Integer(1),new
Integer(1)) == 0);
>>      }
>>
>> -    @Test
>> -    public void testCompareIncomparable() {
>> -        try {
>> -            ComparableComparator.instance().compare(new Object(),new Integer(2));
>> -            fail("Expected ClassCastException");
>> -        } catch(ClassCastException e) {
>> -            // expected
>> -        }
>> -    }
>> -
>> -    @Test
>> +    @Test(expected=NullPointerException.class)
>>      public void testCompareNull() {
>> -        try {
>> -            ComparableComparator.instance().compare(null,new Integer(2));
>> -            fail("Expected NullPointerException");
>> -        } catch(NullPointerException e) {
>> -            // expected
>> -        }
>> +        ComparableComparator.<Integer>instance().compare(null,new Integer(2));
>>      }
>>
>>      @Test
>>      public void testEqualsAndHashCode() {
>> -        assertEquals(new ComparableComparator(),new ComparableComparator());
>> -        assertEquals(new ComparableComparator().hashCode(),new ComparableComparator().hashCode());
>> -        assertTrue(!new ComparableComparator().equals(null));
>> +        assertEquals(new ComparableComparator<Integer>(),new ComparableComparator<Integer>());
>> +        assertEquals(new ComparableComparator<Integer>().hashCode(),new ComparableComparator<Integer>().hashCode());
>> +        assertTrue(!new ComparableComparator<Integer>().equals(null));
>>      }
>>  }
>>
>> Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparatorFunction.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparatorFunction.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparatorFunction.java
(original)
>> +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestComparatorFunction.java
Mon Jul 23 15:21:25 2012
>> @@ -75,11 +75,10 @@ public class TestComparatorFunction exte
>>      }
>>
>>      @Test
>> -    @SuppressWarnings("unchecked")
>>      public void testEquals() {
>>          ComparatorFunction<Comparable<?>> f = ComparatorFunction.instance();
>>          assertObjectsAreEqual(f,f);
>> -        assertObjectsAreEqual(f,new ComparatorFunction<Comparable<?>>(ComparableComparator.INSTANCE));
>> +        assertObjectsAreEqual(f,new ComparatorFunction<Integer>(ComparableComparator.<Integer>instance()));
>>          assertObjectsAreNotEqual(f,new ComparatorFunction<Boolean>(Collections.reverseOrder()));
>>      }
>>  }
>>
>> Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsEquivalent.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsEquivalent.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsEquivalent.java
(original)
>> +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsEquivalent.java
Mon Jul 23 15:21:25 2012
>> @@ -55,13 +55,12 @@ public class TestIsEquivalent extends Ba
>>      }
>>
>>      @Test
>> -    @SuppressWarnings("unchecked")
>>      public void testEquals() throws Exception {
>>          IsEquivalent<Comparable<?>> p = IsEquivalent.INSTANCE;
>>          assertEquals(p,p);
>>
>>          assertObjectsAreEqual(p,IsEquivalent.instance());
>> -        assertObjectsAreEqual(p,new IsEquivalent<Comparable<?>>(new
ComparableComparator()));
>> +        assertObjectsAreEqual(p,new IsEquivalent<Integer>(ComparableComparator.<Integer>instance()));
>>          assertObjectsAreNotEqual(p,Constant.FALSE);
>>      }
>>
>>
>> Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsGreaterThan.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsGreaterThan.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsGreaterThan.java
(original)
>> +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsGreaterThan.java
Mon Jul 23 15:21:25 2012
>> @@ -56,13 +56,12 @@ public class TestIsGreaterThan extends B
>>      }
>>
>>      @Test
>> -    @SuppressWarnings("unchecked")
>>      public void testEquals() throws Exception {
>>          IsGreaterThan<Comparable<?>> p = new IsGreaterThan<Comparable<?>>();
>>          assertEquals(p,p);
>>
>>          assertObjectsAreEqual(p,new IsGreaterThan<Comparable<?>>());
>> -        assertObjectsAreEqual(p,new IsGreaterThan<Comparable<?>>(new
ComparableComparator()));
>> +        assertObjectsAreEqual(p,new IsGreaterThan<Integer>(ComparableComparator.<Integer>instance()));
>>          assertObjectsAreEqual(p,IsGreaterThan.instance());
>>          assertObjectsAreNotEqual(p,Constant.FALSE);
>>      }
>>
>> Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsGreaterThanOrEqual.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsGreaterThanOrEqual.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsGreaterThanOrEqual.java
(original)
>> +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsGreaterThanOrEqual.java
Mon Jul 23 15:21:25 2012
>> @@ -56,13 +56,12 @@ public class TestIsGreaterThanOrEqual ex
>>      }
>>
>>      @Test
>> -    @SuppressWarnings("unchecked")
>>      public void testEquals() throws Exception {
>>          IsGreaterThanOrEqual<Comparable<?>> p = new IsGreaterThanOrEqual<Comparable<?>>();
>>          assertEquals(p,p);
>>
>>          assertObjectsAreEqual(p,new IsGreaterThanOrEqual<Comparable<?>>());
>> -        assertObjectsAreEqual(p,new IsGreaterThanOrEqual<Comparable<?>>(new
ComparableComparator()));
>> +        assertObjectsAreEqual(p,new IsGreaterThanOrEqual<Integer>(ComparableComparator.<Integer>instance()));
>>          assertObjectsAreEqual(p,IsGreaterThanOrEqual.instance());
>>          assertObjectsAreNotEqual(p,Constant.FALSE);
>>      }
>>
>> Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsLessThan.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsLessThan.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsLessThan.java
(original)
>> +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsLessThan.java
Mon Jul 23 15:21:25 2012
>> @@ -56,13 +56,12 @@ public class TestIsLessThan extends Base
>>      }
>>
>>      @Test
>> -    @SuppressWarnings("unchecked")
>>      public void testEquals() throws Exception {
>>          IsLessThan<Comparable<?>> p = new IsLessThan<Comparable<?>>();
>>          assertEquals(p,p);
>>
>>          assertObjectsAreEqual(p,new IsLessThan<Comparable<?>>());
>> -        assertObjectsAreEqual(p,new IsLessThan<Comparable<?>>(new ComparableComparator()));
>> +        assertObjectsAreEqual(p,new IsLessThan<Integer>(ComparableComparator.<Integer>instance()));
>>          assertObjectsAreEqual(p,IsLessThan.instance());
>>          assertObjectsAreNotEqual(p,Constant.FALSE);
>>      }
>>
>> Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsLessThanOrEqual.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsLessThanOrEqual.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsLessThanOrEqual.java
(original)
>> +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsLessThanOrEqual.java
Mon Jul 23 15:21:25 2012
>> @@ -56,13 +56,12 @@ public class TestIsLessThanOrEqual exten
>>      }
>>
>>      @Test
>> -    @SuppressWarnings("unchecked")
>>      public void testEquals() throws Exception {
>>          IsLessThanOrEqual<Comparable<?>> p = new IsLessThanOrEqual<Comparable<?>>();
>>          assertEquals(p,p);
>>
>>          assertObjectsAreEqual(p,new IsLessThanOrEqual<Comparable<?>>());
>> -        assertObjectsAreEqual(p,new IsLessThanOrEqual<Comparable<?>>(new
ComparableComparator()));
>> +        assertObjectsAreEqual(p,new IsLessThanOrEqual<Integer>(ComparableComparator.<Integer>instance()));
>>          assertObjectsAreEqual(p,IsLessThanOrEqual.instance());
>>          assertObjectsAreNotEqual(p,Constant.FALSE);
>>      }
>>
>> Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsNotEquivalent.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsNotEquivalent.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsNotEquivalent.java
(original)
>> +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestIsNotEquivalent.java
Mon Jul 23 15:21:25 2012
>> @@ -55,12 +55,11 @@ public class TestIsNotEquivalent extends
>>      }
>>
>>      @Test
>> -    @SuppressWarnings("unchecked")
>>      public void testEquals() throws Exception {
>>          IsNotEquivalent<Comparable<?>> p = new IsNotEquivalent<Comparable<?>>();
>>          assertEquals(p,p);
>>
>> -        assertObjectsAreEqual(p,new IsNotEquivalent<Comparable<?>>(new
ComparableComparator()));
>> +        assertObjectsAreEqual(p,new IsNotEquivalent<Integer>(ComparableComparator.<Integer>instance()));
>>          assertObjectsAreEqual(p,IsNotEquivalent.instance());
>>          assertObjectsAreNotEqual(p,Constant.FALSE);
>>      }
>>
>> Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestMax.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestMax.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestMax.java
(original)
>> +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestMax.java
Mon Jul 23 15:21:25 2012
>> @@ -56,12 +56,11 @@ public class TestMax extends BaseFunctor
>>      }
>>
>>      @Test
>> -    @SuppressWarnings("unchecked")
>>      public void testEquals() {
>>          Max<Comparable<?>> f = Max.instance();
>>          assertObjectsAreEqual(f,f);
>>          assertObjectsAreEqual(f,Max.instance());
>> -        assertObjectsAreEqual(f,new Max<Comparable<?>>(ComparableComparator.INSTANCE));
>> +        assertObjectsAreEqual(f,new Max<Integer>(ComparableComparator.<Integer>instance()));
>>          assertObjectsAreNotEqual(f,new Max<Comparable<?>>(Collections.<Comparable<?>>reverseOrder()));
>>      }
>>  }
>>
>> Modified: commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestMin.java
>> URL: http://svn.apache.org/viewvc/commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestMin.java?rev=1364676&r1=1364675&r2=1364676&view=diff
>> ==============================================================================
>> --- commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestMin.java
(original)
>> +++ commons/proper/functor/trunk/src/test/java/org/apache/commons/functor/core/comparator/TestMin.java
Mon Jul 23 15:21:25 2012
>> @@ -56,12 +56,11 @@ public class TestMin extends BaseFunctor
>>      }
>>
>>      @Test
>> -    @SuppressWarnings("unchecked")
>>      public void testEquals() {
>>          Min<Comparable<?>> f = Min.instance();
>>          assertObjectsAreEqual(f,f);
>>          assertObjectsAreEqual(f,Min.instance());
>> -        assertObjectsAreEqual(f,new Min<Comparable<?>>(ComparableComparator.INSTANCE));
>> +        assertObjectsAreEqual(f,new Min<Integer>(ComparableComparator.<Integer>instance()));
>>          assertObjectsAreNotEqual(f,new Min<Comparable<?>>(Collections.<Comparable<?>>reverseOrder()));
>>      }
>>  }
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message