clean up toClass(Object[]) test

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@907099 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Matthew Jason Benson 2010-02-05 21:22:29 +00:00
parent 0d828cd075
commit 5d5a31a827
1 changed files with 5 additions and 13 deletions

View File

@ -20,6 +20,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -899,21 +900,12 @@ public class ClassUtilsTest extends TestCase {
} }
public void testToClass_object() { public void testToClass_object() {
assertEquals(null, ClassUtils.toClass(null)); assertNull(ClassUtils.toClass(null));
assertSame( assertSame(ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.toClass(ArrayUtils.EMPTY_OBJECT_ARRAY));
ArrayUtils.EMPTY_CLASS_ARRAY,
ClassUtils.toClass(new Class[0]));
Object[] array = new Object[3]; assertTrue(Arrays.equals(new Class[] { String.class, Integer.class, Double.class },
array[0] = new String("Test"); ClassUtils.toClass(new Object[] { "Test", 1, 99d })));
array[1] = new Integer(1);
array[2] = new Double(99);
Class<?>[] results = ClassUtils.toClass(array);
assertEquals("String", ClassUtils.getShortClassName(results[0]));
assertEquals("Integer", ClassUtils.getShortClassName(results[1]));
assertEquals("Double", ClassUtils.getShortClassName(results[2]));
} }
public void test_getShortCanonicalName_Object() { public void test_getShortCanonicalName_Object() {