commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1132389 - in /commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3: ClassUtilsTest.java StringUtilsEqualsIndexOfTest.java StringUtilsTest.java StringUtilsTrimEmptyTest.java
Date Sun, 05 Jun 2011 12:44:41 GMT
Author: sebb
Date: Sun Jun  5 12:44:41 2011
New Revision: 1132389

URL: http://svn.apache.org/viewvc?rev=1132389&view=rev
Log:
Eliminate varargs warnings

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/StringUtilsEqualsIndexOfTest.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=1132389&r1=1132388&r2=1132389&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 Sun
Jun  5 12:44:41 2011
@@ -301,7 +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, null));
+        assertTrue(ClassUtils.isAssignable(array0, (Class<?>[]) null)); // test both
types of ...
+        assertTrue(ClassUtils.isAssignable(array0, (Class<?>) null));   // ... varargs
invocation
         assertTrue(ClassUtils.isAssignable((Class[]) null, (Class[]) null));
 
         assertFalse(ClassUtils.isAssignable(array1, array1s));
@@ -729,8 +730,8 @@ public class ClassUtilsTest extends Test
 
     public void testPrimitivesToWrappers() {
         // test null
-        assertNull("null -> null",
-            ClassUtils.primitivesToWrappers(null));
+        assertNull("null -> null", ClassUtils.primitivesToWrappers((Class<?>[])
null)); // test both types of ...
+        assertNull("null -> null", ClassUtils.primitivesToWrappers((Class<?>) null));
  // ... varargs invocation
         // test empty array
         assertEquals("empty -> empty",
                 ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.primitivesToWrappers(ArrayUtils.EMPTY_CLASS_ARRAY));
@@ -800,7 +801,9 @@ public class ClassUtilsTest extends Test
     }
 
     public void testWrappersToPrimitivesNull() {
-        assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives(null));
+        // 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));
     }
 
     public void testWrappersToPrimitivesEmpty() {
@@ -955,15 +958,17 @@ public class ClassUtilsTest extends Test
     }
 
     public void testToClass_object() {
-        assertNull(ClassUtils.toClass(null));
+        // Test both types of varargs invocation
+        assertNull(ClassUtils.toClass((Object[]) null));
+        assertNull(ClassUtils.toClass((Object) null));
 
         assertSame(ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.toClass(ArrayUtils.EMPTY_OBJECT_ARRAY));
 
         assertTrue(Arrays.equals(new Class[] { String.class, Integer.class, Double.class
},
-                ClassUtils.toClass(new Object[] { "Test", 1, 99d })));
+                ClassUtils.toClass(new Object[] { "Test", Integer.valueOf(1), Double.valueOf(99d)
})));
 
         assertTrue(Arrays.equals(new Class[] { String.class, null, Double.class },
-                ClassUtils.toClass(new Object[] { "Test", null, 99d })));
+                ClassUtils.toClass(new Object[] { "Test", null, Double.valueOf(99d) })));
     }
 
     public void test_getShortCanonicalName_Object() {

Modified: commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java?rev=1132389&r1=1132388&r2=1132389&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
(original)
+++ commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java
Sun Jun  5 12:44:41 2011
@@ -730,9 +730,11 @@ public class StringUtilsEqualsIndexOfTes
     }
 
     public void testLastIndexOfAny_StringStringArray() {
-        assertEquals(-1, StringUtils.lastIndexOfAny(null, null));
+        assertEquals(-1, StringUtils.lastIndexOfAny(null, (CharSequence) null));   // test
both types of ...
+        assertEquals(-1, StringUtils.lastIndexOfAny(null, (CharSequence[]) null)); // ...
varargs invocation
         assertEquals(-1, StringUtils.lastIndexOfAny(null, FOOBAR_SUB_ARRAY));
-        assertEquals(-1, StringUtils.lastIndexOfAny(FOOBAR, null));
+        assertEquals(-1, StringUtils.lastIndexOfAny(FOOBAR, (CharSequence) null));   // test
both types of ...
+        assertEquals(-1, StringUtils.lastIndexOfAny(FOOBAR, (CharSequence[]) null)); // ...
varargs invocation
         assertEquals(3, StringUtils.lastIndexOfAny(FOOBAR, FOOBAR_SUB_ARRAY));
         assertEquals(-1, StringUtils.lastIndexOfAny(FOOBAR, new String[0]));
         assertEquals(-1, StringUtils.lastIndexOfAny(null, new String[0]));

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=1132389&r1=1132388&r2=1132389&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
Sun Jun  5 12:44:41 2011
@@ -174,7 +174,9 @@ public class StringUtilsTest extends Tes
     }
 
     public void testJoin_Objectarray() {
-        assertEquals(null, StringUtils.join(null));
+        // Test both types of varargs invocation
+        assertEquals(null, StringUtils.join((Object[]) null));
+        assertEquals(null, StringUtils.join((Object) null));
         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=1132389&r1=1132388&r2=1132389&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
Sun Jun  5 12:44:41 2011
@@ -230,7 +230,9 @@ public class StringUtilsTrimEmptyTest ex
         String[] fooDots = new String[] { ".."+FOO+"..", ".."+FOO, FOO+".." };
         String[] foo = new String[] { FOO, FOO, FOO };
 
-        assertEquals(null, StringUtils.stripAll(null));
+        // Test both varargs invocations
+        assertEquals(null, StringUtils.stripAll((String[]) null));
+        assertEquals(null, StringUtils.stripAll((String) null));
         assertArrayEquals(empty, StringUtils.stripAll(empty));
         assertArrayEquals(foo, StringUtils.stripAll(fooSpace));
         



Mime
View raw message