commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1132658 - in /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3: ClassUtilsTest.java StringUtilsTest.java StringUtilsTrimEmptyTest.java
Date Mon, 06 Jun 2011 14:24:21 GMT
Author: sebb
Date: Mon Jun  6 14:24:21 2011
New Revision: 1132658

URL: http://svn.apache.org/viewvc?rev=1132658&view=rev
Log:
Revert r113289 - varargs invocation does not work with null

Modified:
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTrimEmptyTest.java

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java?rev=1132658&r1=1132657&r2=1132658&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java (original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java Mon
Jun  6 14:24:21 2011
@@ -301,8 +301,8 @@ public class ClassUtilsTest extends Test
         assertFalse(ClassUtils.isAssignable(null, array2));
         assertTrue(ClassUtils.isAssignable(null, array0));
         assertTrue(ClassUtils.isAssignable(array0, array0));
-        assertTrue(ClassUtils.isAssignable(array0, (Class<?>[]) null)); // test both
types of ...
-        assertTrue(ClassUtils.isAssignable(array0, (Class<?>) null));   // ... varargs
invocation
+//        assertTrue(ClassUtils.isAssignable(array0, null)); 
+        assertTrue(ClassUtils.isAssignable(array0, (Class<?>[]) null)); // explicit
cast to avoid warning
         assertTrue(ClassUtils.isAssignable((Class[]) null, (Class[]) null));
 
         assertFalse(ClassUtils.isAssignable(array1, array1s));
@@ -730,8 +730,8 @@ public class ClassUtilsTest extends Test
 
     public void testPrimitivesToWrappers() {
         // test null
-        assertNull("null -> null", ClassUtils.primitivesToWrappers((Class<?>[])
null)); // test both types of ...
-        assertNull("null -> null", ClassUtils.primitivesToWrappers((Class<?>) null));
  // ... varargs invocation
+//        assertNull("null -> null", ClassUtils.primitivesToWrappers(null));
+        assertNull("null -> null", ClassUtils.primitivesToWrappers((Class<?>[])
null)); // explicit cast to avoid warning
         // test empty array
         assertEquals("empty -> empty",
                 ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.primitivesToWrappers(ArrayUtils.EMPTY_CLASS_ARRAY));
@@ -801,9 +801,8 @@ public class ClassUtilsTest extends Test
     }
 
     public void testWrappersToPrimitivesNull() {
-        // Test both types of varargs invocation
-        assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives((Class<?>[])
null));
-        assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives((Class<?>)
null));
+//        assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives(null));
+        assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives((Class<?>[])
null)); // explicit cast
     }
 
     public void testWrappersToPrimitivesEmpty() {
@@ -958,9 +957,8 @@ public class ClassUtilsTest extends Test
     }
 
     public void testToClass_object() {
-        // Test both types of varargs invocation
-        assertNull(ClassUtils.toClass((Object[]) null));
-        assertNull(ClassUtils.toClass((Object) null));
+//        assertNull(ClassUtils.toClass(null));
+        assertNull(ClassUtils.toClass((Object[]) null)); // explicit cast
 
         assertSame(ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.toClass(ArrayUtils.EMPTY_OBJECT_ARRAY));
 

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java?rev=1132658&r1=1132657&r2=1132658&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTest.java
Mon Jun  6 14:24:21 2011
@@ -174,9 +174,8 @@ public class StringUtilsTest extends Tes
     }
 
     public void testJoin_Objectarray() {
-        // Test both types of varargs invocation
-        assertEquals(null, StringUtils.join((Object[]) null));
-        assertEquals(null, StringUtils.join((Object) null));
+//        assertEquals(null, StringUtils.join(null));
+        assertEquals(null, StringUtils.join((Object[]) null)); // explicit cast
         assertEquals("", StringUtils.join(EMPTY_ARRAY_LIST));
         assertEquals("", StringUtils.join(NULL_ARRAY_LIST));
         assertEquals("abc", StringUtils.join(new String[] {"a", "b", "c"}));

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTrimEmptyTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTrimEmptyTest.java?rev=1132658&r1=1132657&r2=1132658&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTrimEmptyTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsTrimEmptyTest.java
Mon Jun  6 14:24:21 2011
@@ -230,9 +230,8 @@ public class StringUtilsTrimEmptyTest ex
         String[] fooDots = new String[] { ".."+FOO+"..", ".."+FOO, FOO+".." };
         String[] foo = new String[] { FOO, FOO, FOO };
 
-        // Test both varargs invocations
-        assertEquals(null, StringUtils.stripAll((String[]) null));
-        assertEquals(null, StringUtils.stripAll((String) null));
+//        assertEquals(null, StringUtils.stripAll(null));
+        assertEquals(null, StringUtils.stripAll((String[]) null)); // explicit cast
         assertArrayEquals(empty, StringUtils.stripAll(empty));
         assertArrayEquals(foo, StringUtils.stripAll(fooSpace));
         



Mime
View raw message