commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r756844 - /commons/proper/lang/trunk/src/test/org/apache/commons/lang/ObjectUtilsTest.java
Date Sat, 21 Mar 2009 00:17:44 GMT
Author: sebb
Date: Sat Mar 21 00:17:43 2009
New Revision: 756844

URL: http://svn.apache.org/viewvc?rev=756844&view=rev
Log:
ObjectUtils.max(null,null) requires casts to agree with signature; likewise min
Also use actual Date objects rather than generic Comparable.

Modified:
    commons/proper/lang/trunk/src/test/org/apache/commons/lang/ObjectUtilsTest.java

Modified: commons/proper/lang/trunk/src/test/org/apache/commons/lang/ObjectUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/org/apache/commons/lang/ObjectUtilsTest.java?rev=756844&r1=756843&r2=756844&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/org/apache/commons/lang/ObjectUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/org/apache/commons/lang/ObjectUtilsTest.java Sat Mar
21 00:17:43 2009
@@ -19,6 +19,7 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Modifier;
 import java.util.Calendar;
+import java.util.Date;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -178,11 +179,11 @@
     
     public void testMax() {
         Calendar calendar = Calendar.getInstance();
-        Comparable nonNullComparable1 = calendar.getTime();
-        Comparable nonNullComparable2 = calendar.getTime();
+        Date nonNullComparable1 = calendar.getTime();
+        Date nonNullComparable2 = calendar.getTime();
         
         calendar.set( Calendar.YEAR, calendar.get( Calendar.YEAR ) -1 );
-        Comparable minComparable = calendar.getTime();
+        Date minComparable = calendar.getTime();
         
         assertNotSame( nonNullComparable1, nonNullComparable2 );
         
@@ -193,16 +194,16 @@
         assertSame( nonNullComparable1, ObjectUtils.max( nonNullComparable1, minComparable
) );
         assertSame( nonNullComparable1, ObjectUtils.max( minComparable, nonNullComparable1
) );
 
-        assertNull( ObjectUtils.max(null, null) );
+        assertNull( ObjectUtils.max((String)null, (String)null) );
     }
     
     public void testMin() {
         Calendar calendar = Calendar.getInstance();
-        Comparable nonNullComparable1 = calendar.getTime();
-        Comparable nonNullComparable2 = calendar.getTime();
+        Date nonNullComparable1 = calendar.getTime();
+        Date nonNullComparable2 = calendar.getTime();
         
         calendar.set( Calendar.YEAR, calendar.get( Calendar.YEAR ) -1 );
-        Comparable minComparable = calendar.getTime();
+        Date minComparable = calendar.getTime();
         
         assertNotSame( nonNullComparable1, nonNullComparable2 );
         
@@ -213,6 +214,6 @@
         assertSame( minComparable, ObjectUtils.min( nonNullComparable1, minComparable ) );
         assertSame( minComparable, ObjectUtils.min( minComparable, nonNullComparable1 ) );
 
-        assertNull( ObjectUtils.min(null, null) );
+        assertNull( ObjectUtils.min((String)null, (String)null) );
     }
 }



Mime
View raw message