commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r904080 - in /commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang: ArrayUtilsAddTest.java ArrayUtilsRemoveTest.java
Date Thu, 28 Jan 2010 13:33:33 GMT
Author: niallp
Date: Thu Jan 28 13:33:33 2010
New Revision: 904080

URL: http://svn.apache.org/viewvc?rev=904080&view=rev
Log:
Port ArrayUtils test improvements back to 2.x branch

Modified:
    commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/ArrayUtilsAddTest.java
    commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/ArrayUtilsRemoveTest.java

Modified: commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/ArrayUtilsAddTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/ArrayUtilsAddTest.java?rev=904080&r1=904079&r2=904080&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/ArrayUtilsAddTest.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/ArrayUtilsAddTest.java
Thu Jan 28 13:33:33 2010
@@ -229,7 +229,7 @@
         Object[] newArray;
         String[] stringArray1 = new String[]{"a", "b", "c"};
         String[] stringArray2 = new String[]{"1", "2", "3"};
-        newArray = ArrayUtils.addAll(stringArray1, null);
+        newArray = ArrayUtils.addAll(stringArray1, (String[]) null);
         assertNotSame(stringArray1, newArray);
         assertTrue(Arrays.equals(stringArray1, newArray));
         assertTrue(Arrays.equals((new String[]{"a", "b", "c"}), newArray));
@@ -242,7 +242,7 @@
         newArray = ArrayUtils.addAll(stringArray1, stringArray2);
         assertTrue(Arrays.equals((new String[]{"a", "b", "c", "1", "2", "3"}), newArray));
         assertEquals(String.class, newArray.getClass().getComponentType());
-        newArray = ArrayUtils.addAll(ArrayUtils.EMPTY_STRING_ARRAY, null);
+        newArray = ArrayUtils.addAll(ArrayUtils.EMPTY_STRING_ARRAY, (String[]) null);
         assertTrue(Arrays.equals(ArrayUtils.EMPTY_STRING_ARRAY, newArray));
         assertTrue(Arrays.equals((new String[]{}), newArray));
         assertEquals(String.class, newArray.getClass().getComponentType());

Modified: commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/ArrayUtilsRemoveTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/ArrayUtilsRemoveTest.java?rev=904080&r1=904079&r2=904080&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/ArrayUtilsRemoveTest.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/ArrayUtilsRemoveTest.java
Thu Jan 28 13:33:33 2010
@@ -68,7 +68,22 @@
             fail("IndexOutOfBoundsException expected");
         } catch (IndexOutOfBoundsException e) {}
     }
-    
+
+    public void testRemoveNumberArray(){
+        Number[] inarray = {new Integer(1), new Long(2), new Byte((byte) 3)};
+        assertEquals(3, inarray.length);
+        Number[] outarray;
+        outarray = (Number[])ArrayUtils.remove(inarray, 1);
+        assertEquals(2, outarray.length);
+        assertEquals(Number.class, outarray.getClass().getComponentType());
+        outarray = (Number[])ArrayUtils.remove(outarray, 1);
+        assertEquals(1, outarray.length);
+        assertEquals(Number.class, outarray.getClass().getComponentType());
+        outarray = (Number[])ArrayUtils.remove(outarray, 0);
+        assertEquals(0, outarray.length);
+        assertEquals(Number.class, outarray.getClass().getComponentType());
+    }
+
     public void testRemoveBooleanArray() {
         boolean[] array;
         array = ArrayUtils.remove(new boolean[] {true}, 0);



Mime
View raw message