Port to JUnit 4.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1158284 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2011-08-16 14:11:31 +00:00
parent 866705e3c6
commit 76416c0ad8
1 changed files with 26 additions and 2 deletions

View File

@ -17,17 +17,23 @@
package org.apache.commons.lang3;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Arrays;
import junit.framework.TestCase;
import org.junit.Test;
/**
* Tests ArrayUtils remove and removeElement methods.
*
* @version $Id$
*/
public class ArrayUtilsRemoveTest extends TestCase {
public class ArrayUtilsRemoveTest {
@Test
public void testRemoveObjectArray() {
Object[] array;
array = ArrayUtils.remove(new Object[] {"a"}, 0);
@ -56,6 +62,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
} catch (IndexOutOfBoundsException e) {}
}
@Test
public void testRemoveNumberArray(){
Number[] inarray = {Integer.valueOf(1),Long.valueOf(2),Byte.valueOf((byte) 3)};
assertEquals(3, inarray.length);
@ -71,6 +78,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
assertEquals(Number.class, outarray.getClass().getComponentType());
}
@Test
public void testRemoveBooleanArray() {
boolean[] array;
array = ArrayUtils.remove(new boolean[] {true}, 0);
@ -99,6 +107,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
} catch (IndexOutOfBoundsException e) {}
}
@Test
public void testRemoveByteArray() {
byte[] array;
array = ArrayUtils.remove(new byte[] {1}, 0);
@ -127,6 +136,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
} catch (IndexOutOfBoundsException e) {}
}
@Test
public void testRemoveCharArray() {
char[] array;
array = ArrayUtils.remove(new char[] {'a'}, 0);
@ -155,6 +165,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
} catch (IndexOutOfBoundsException e) {}
}
@Test
public void testRemoveDoubleArray() {
double[] array;
array = ArrayUtils.remove(new double[] {1}, 0);
@ -183,6 +194,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
} catch (IndexOutOfBoundsException e) {}
}
@Test
public void testRemoveFloatArray() {
float[] array;
array = ArrayUtils.remove(new float[] {1}, 0);
@ -211,6 +223,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
} catch (IndexOutOfBoundsException e) {}
}
@Test
public void testRemoveIntArray() {
int[] array;
array = ArrayUtils.remove(new int[] {1}, 0);
@ -239,6 +252,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
} catch (IndexOutOfBoundsException e) {}
}
@Test
public void testRemoveLongArray() {
long[] array;
array = ArrayUtils.remove(new long[] {1}, 0);
@ -267,6 +281,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
} catch (IndexOutOfBoundsException e) {}
}
@Test
public void testRemoveShortArray() {
short[] array;
array = ArrayUtils.remove(new short[] {1}, 0);
@ -295,6 +310,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
} catch (IndexOutOfBoundsException e) {}
}
@Test
public void testRemoveElementObjectArray() {
Object[] array;
array = ArrayUtils.removeElement((Object[]) null, "a");
@ -313,6 +329,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
assertEquals(Object.class, array.getClass().getComponentType());
}
@Test
public void testRemoveElementBooleanArray() {
boolean[] array;
array = ArrayUtils.removeElement((boolean[]) null, true);
@ -331,6 +348,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
assertEquals(Boolean.TYPE, array.getClass().getComponentType());
}
@Test
public void testRemoveElementByteArray() {
byte[] array;
array = ArrayUtils.removeElement((byte[]) null, (byte) 1);
@ -349,6 +367,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
assertEquals(Byte.TYPE, array.getClass().getComponentType());
}
@Test
public void testRemoveElementCharArray() {
char[] array;
array = ArrayUtils.removeElement((char[]) null, 'a');
@ -367,6 +386,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
assertEquals(Character.TYPE, array.getClass().getComponentType());
}
@Test
@SuppressWarnings("cast")
public void testRemoveElementDoubleArray() {
double[] array;
@ -386,6 +406,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
assertEquals(Double.TYPE, array.getClass().getComponentType());
}
@Test
@SuppressWarnings("cast")
public void testRemoveElementFloatArray() {
float[] array;
@ -405,6 +426,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
assertEquals(Float.TYPE, array.getClass().getComponentType());
}
@Test
public void testRemoveElementIntArray() {
int[] array;
array = ArrayUtils.removeElement((int[]) null, 1);
@ -423,6 +445,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
assertEquals(Integer.TYPE, array.getClass().getComponentType());
}
@Test
@SuppressWarnings("cast")
public void testRemoveElementLongArray() {
long[] array;
@ -442,6 +465,7 @@ public class ArrayUtilsRemoveTest extends TestCase {
assertEquals(Long.TYPE, array.getClass().getComponentType());
}
@Test
public void testRemoveElementShortArray() {
short[] array;
array = ArrayUtils.removeElement((short[]) null, (short) 1);