commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject [1/2] [lang] Sort members.
Date Mon, 23 Oct 2017 16:40:21 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master 6ce88517b -> b52c69b1b


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/b52c69b1/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
index 6b97fb5..5aa2baf 100644
--- a/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
@@ -50,182 +50,108 @@ import org.junit.Test;
 @SuppressWarnings("boxing") // JUnit4 does not support primitive equality testing apart from long
 public class ClassUtilsTest  {
 
-    private static class Inner {
-        private class DeeplyNested{}
+    private static class CX implements IB, IA, IE {
     }
 
-    //-----------------------------------------------------------------------
-    @Test
-    public void testConstructor() {
-        assertNotNull(new ClassUtils());
-        final Constructor<?>[] cons = ClassUtils.class.getDeclaredConstructors();
-        assertEquals(1, cons.length);
-        assertTrue(Modifier.isPublic(cons[0].getModifiers()));
-        assertTrue(Modifier.isPublic(ClassUtils.class.getModifiers()));
-        assertFalse(Modifier.isFinal(ClassUtils.class.getModifiers()));
+    private static class CY extends CX implements IB, IC {
     }
 
-    // -------------------------------------------------------------------------
-    @Test
-    public void test_getShortClassName_Object() {
-        assertEquals("ClassUtils", ClassUtils.getShortClassName(new ClassUtils(), "<null>"));
-        assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(new Inner(), "<null>"));
-        assertEquals("String", ClassUtils.getShortClassName("hello", "<null>"));
-        assertEquals("<null>", ClassUtils.getShortClassName(null, "<null>"));
-
-        // Inner types
-        class Named {}
-        assertEquals("ClassUtilsTest.1", ClassUtils.getShortClassName(new Object(){}, "<null>"));
-        assertEquals("ClassUtilsTest.1Named", ClassUtils.getShortClassName(new Named(), "<null>"));
-        assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(new Inner(), "<null>"));
+    private interface IA {
     }
 
-    @Test
-    public void test_getShortClassName_Class() {
-        assertEquals("ClassUtils", ClassUtils.getShortClassName(ClassUtils.class));
-        assertEquals("Map.Entry", ClassUtils.getShortClassName(Map.Entry.class));
-        assertEquals("", ClassUtils.getShortClassName((Class<?>) null));
-
-        // LANG-535
-        assertEquals("String[]", ClassUtils.getShortClassName(String[].class));
-        assertEquals("Map.Entry[]", ClassUtils.getShortClassName(Map.Entry[].class));
-
-        // Primitives
-        assertEquals("boolean", ClassUtils.getShortClassName(boolean.class));
-        assertEquals("byte", ClassUtils.getShortClassName(byte.class));
-        assertEquals("char", ClassUtils.getShortClassName(char.class));
-        assertEquals("short", ClassUtils.getShortClassName(short.class));
-        assertEquals("int", ClassUtils.getShortClassName(int.class));
-        assertEquals("long", ClassUtils.getShortClassName(long.class));
-        assertEquals("float", ClassUtils.getShortClassName(float.class));
-        assertEquals("double", ClassUtils.getShortClassName(double.class));
-
-        // Primitive Arrays
-        assertEquals("boolean[]", ClassUtils.getShortClassName(boolean[].class));
-        assertEquals("byte[]", ClassUtils.getShortClassName(byte[].class));
-        assertEquals("char[]", ClassUtils.getShortClassName(char[].class));
-        assertEquals("short[]", ClassUtils.getShortClassName(short[].class));
-        assertEquals("int[]", ClassUtils.getShortClassName(int[].class));
-        assertEquals("long[]", ClassUtils.getShortClassName(long[].class));
-        assertEquals("float[]", ClassUtils.getShortClassName(float[].class));
-        assertEquals("double[]", ClassUtils.getShortClassName(double[].class));
-
-        // Arrays of arrays of ...
-        assertEquals("String[][]", ClassUtils.getShortClassName(String[][].class));
-        assertEquals("String[][][]", ClassUtils.getShortClassName(String[][][].class));
-        assertEquals("String[][][][]", ClassUtils.getShortClassName(String[][][][].class));
-
-        // Inner types
-        class Named {}
-        assertEquals("ClassUtilsTest.2", ClassUtils.getShortClassName(new Object(){}.getClass()));
-        assertEquals("ClassUtilsTest.2Named", ClassUtils.getShortClassName(Named.class));
-        assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(Inner.class));
+    private interface IB {
     }
 
 
 
-    @Test
-    public void test_getShortClassName_String() {
-        assertEquals("ClassUtils", ClassUtils.getShortClassName(ClassUtils.class.getName()));
-        assertEquals("Map.Entry", ClassUtils.getShortClassName(Map.Entry.class.getName()));
-        assertEquals("", ClassUtils.getShortClassName((String) null));
-        assertEquals("", ClassUtils.getShortClassName(""));
+    private interface IC extends ID, IE {
     }
 
-    @Test
-    public void test_getSimpleName_Class() {
-        assertEquals("ClassUtils", ClassUtils.getSimpleName(ClassUtils.class));
-        assertEquals("Entry", ClassUtils.getSimpleName(Map.Entry.class));
-        assertEquals("", ClassUtils.getSimpleName(null));
+    private interface ID {
+    }
 
-        // LANG-535
-        assertEquals("String[]", ClassUtils.getSimpleName(String[].class));
-        assertEquals("Entry[]", ClassUtils.getSimpleName(Map.Entry[].class));
+    private interface IE extends IF {
+    }
 
-        // Primitives
-        assertEquals("boolean", ClassUtils.getSimpleName(boolean.class));
-        assertEquals("byte", ClassUtils.getSimpleName(byte.class));
-        assertEquals("char", ClassUtils.getSimpleName(char.class));
-        assertEquals("short", ClassUtils.getSimpleName(short.class));
-        assertEquals("int", ClassUtils.getSimpleName(int.class));
-        assertEquals("long", ClassUtils.getSimpleName(long.class));
-        assertEquals("float", ClassUtils.getSimpleName(float.class));
-        assertEquals("double", ClassUtils.getSimpleName(double.class));
+    private interface IF {
+    }
 
-        // Primitive Arrays
-        assertEquals("boolean[]", ClassUtils.getSimpleName(boolean[].class));
-        assertEquals("byte[]", ClassUtils.getSimpleName(byte[].class));
-        assertEquals("char[]", ClassUtils.getSimpleName(char[].class));
-        assertEquals("short[]", ClassUtils.getSimpleName(short[].class));
-        assertEquals("int[]", ClassUtils.getSimpleName(int[].class));
-        assertEquals("long[]", ClassUtils.getSimpleName(long[].class));
-        assertEquals("float[]", ClassUtils.getSimpleName(float[].class));
-        assertEquals("double[]", ClassUtils.getSimpleName(double[].class));
+    private static class Inner {
+        private class DeeplyNested{}
+    }
 
-        // Arrays of arrays of ...
-        assertEquals("String[][]", ClassUtils.getSimpleName(String[][].class));
-        assertEquals("String[][][]", ClassUtils.getSimpleName(String[][][].class));
-        assertEquals("String[][][][]", ClassUtils.getSimpleName(String[][][][].class));
+    private void assertGetClassReturnsClass( final Class<?> c ) throws Exception {
+        assertEquals( c, ClassUtils.getClass( c.getName() ) );
+    }
 
-        // On-the-fly types
-        class Named {}
-        assertEquals("", ClassUtils.getSimpleName(new Object(){}.getClass()));
-        assertEquals("Named", ClassUtils.getSimpleName(Named.class));
+    private void assertGetClassThrowsClassNotFound( final String className ) throws Exception {
+        assertGetClassThrowsException( className, ClassNotFoundException.class );
     }
 
-    @Test
-    public void test_getSimpleName_Object() {
-        assertEquals("ClassUtils", ClassUtils.getSimpleName(new ClassUtils(), "<null>"));
-        assertEquals("Inner", ClassUtils.getSimpleName(new Inner(), "<null>"));
-        assertEquals("String", ClassUtils.getSimpleName("hello", "<null>"));
-        assertEquals("<null>", ClassUtils.getSimpleName(null, "<null>"));
+    private void assertGetClassThrowsException( final String className, final Class<?> exceptionType ) throws Exception {
+        try {
+            ClassUtils.getClass( className );
+            fail( "ClassUtils.getClass() should fail with an exception of type " + exceptionType.getName() + " when given class name \"" + className + "\"." );
+        } catch( final Exception e ) {
+            assertTrue( exceptionType.isAssignableFrom( e.getClass() ) );
+        }
     }
 
-    // -------------------------------------------------------------------------
-    @Test
-    public void test_getPackageName_Object() {
-        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new ClassUtils(), "<null>"));
-        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new Inner(), "<null>"));
-        assertEquals("<null>", ClassUtils.getPackageName(null, "<null>"));
+    private void assertGetClassThrowsNullPointerException( final String className ) throws Exception {
+        assertGetClassThrowsException( className, NullPointerException.class );
     }
 
     @Test
-    public void test_getPackageName_Class() {
-        assertEquals("java.lang", ClassUtils.getPackageName(String.class));
-        assertEquals("java.util", ClassUtils.getPackageName(Map.Entry.class));
-        assertEquals("", ClassUtils.getPackageName((Class<?>) null));
-
-        // LANG-535
-        assertEquals("java.lang", ClassUtils.getPackageName(String[].class));
-
-        // Primitive Arrays
-        assertEquals("", ClassUtils.getPackageName(boolean[].class));
-        assertEquals("", ClassUtils.getPackageName(byte[].class));
-        assertEquals("", ClassUtils.getPackageName(char[].class));
-        assertEquals("", ClassUtils.getPackageName(short[].class));
-        assertEquals("", ClassUtils.getPackageName(int[].class));
-        assertEquals("", ClassUtils.getPackageName(long[].class));
-        assertEquals("", ClassUtils.getPackageName(float[].class));
-        assertEquals("", ClassUtils.getPackageName(double[].class));
+    public void test_convertClassesToClassNames_List() {
+        final List<Class<?>> list = new ArrayList<>();
+        List<String> result = ClassUtils.convertClassesToClassNames(list);
+        assertEquals(0, result.size());
 
-        // Arrays of arrays of ...
-        assertEquals("java.lang", ClassUtils.getPackageName(String[][].class));
-        assertEquals("java.lang", ClassUtils.getPackageName(String[][][].class));
-        assertEquals("java.lang", ClassUtils.getPackageName(String[][][][].class));
+        list.add(String.class);
+        list.add(null);
+        list.add(Object.class);
+        result = ClassUtils.convertClassesToClassNames(list);
+        assertEquals(3, result.size());
+        assertEquals("java.lang.String", result.get(0));
+        assertNull(result.get(1));
+        assertEquals("java.lang.Object", result.get(2));
 
-        // On-the-fly types
-        class Named {}
-        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new Object() {
-        }.getClass()));
-        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(Named.class));
+        @SuppressWarnings("unchecked") // test what happens when non-generic code adds wrong type of element
+        final
+        List<Object> olist = (List<Object>)(List<?>)list;
+        olist.add(new Object());
+        try {
+            ClassUtils.convertClassesToClassNames(list);
+            fail("Should not have been able to convert list");
+        } catch (final ClassCastException expected) {}
+        assertNull(ClassUtils.convertClassesToClassNames(null));
     }
 
+    // -------------------------------------------------------------------------
     @Test
-    public void test_getPackageName_String() {
-        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(ClassUtils.class.getName()));
-        assertEquals("java.util", ClassUtils.getPackageName(Map.Entry.class.getName()));
-        assertEquals("", ClassUtils.getPackageName((String) null));
-        assertEquals("", ClassUtils.getPackageName(""));
+    public void test_convertClassNamesToClasses_List() {
+        final List<String> list = new ArrayList<>();
+        List<Class<?>> result = ClassUtils.convertClassNamesToClasses(list);
+        assertEquals(0, result.size());
+
+        list.add("java.lang.String");
+        list.add("java.lang.xxx");
+        list.add("java.lang.Object");
+        result = ClassUtils.convertClassNamesToClasses(list);
+        assertEquals(3, result.size());
+        assertEquals(String.class, result.get(0));
+        assertNull(result.get(1));
+        assertEquals(Object.class, result.get(2));
+
+        @SuppressWarnings("unchecked") // test what happens when non-generic code adds wrong type of element
+        final
+        List<Object> olist = (List<Object>)(List<?>)list;
+        olist.add(new Object());
+        try {
+            ClassUtils.convertClassNamesToClasses(list);
+            fail("Should not have been able to convert list");
+        } catch (final ClassCastException expected) {}
+        assertNull(ClassUtils.convertClassNamesToClasses(null));
     }
 
     // -------------------------------------------------------------------------
@@ -240,33 +166,19 @@ public class ClassUtilsTest  {
     }
 
     @Test(expected = IllegalArgumentException.class)
-    public void test_getAbbreviatedName_Class_ZeroLen() {
-        ClassUtils.getAbbreviatedName(String.class, 0);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
     public void test_getAbbreviatedName_Class_NegativeLen() {
         ClassUtils.getAbbreviatedName(String.class, -10);
     }
-
+    @Test(expected = IllegalArgumentException.class)
+    public void test_getAbbreviatedName_Class_ZeroLen() {
+        ClassUtils.getAbbreviatedName(String.class, 0);
+    }
     @Test
     public void test_getAbbreviatedName_String() {
         assertEquals("", ClassUtils.getAbbreviatedName((String) null, 1));
         assertEquals("WithoutPackage", ClassUtils.getAbbreviatedName("WithoutPackage", 1));
         assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", 1));
     }
-
-    // -------------------------------------------------------------------------
-    @Test
-    public void test_getAllSuperclasses_Class() {
-        final List<?> list = ClassUtils.getAllSuperclasses(CY.class);
-        assertEquals(2, list.size());
-        assertEquals(CX.class, list.get(0));
-        assertEquals(Object.class, list.get(1));
-
-        assertNull(ClassUtils.getAllSuperclasses(null));
-    }
-
     @Test
     public void test_getAllInterfaces_Class() {
         final List<?> list = ClassUtils.getAllInterfaces(CY.class);
@@ -280,172 +192,276 @@ public class ClassUtilsTest  {
 
         assertNull(ClassUtils.getAllInterfaces(null));
     }
+    // -------------------------------------------------------------------------
+    @Test
+    public void test_getAllSuperclasses_Class() {
+        final List<?> list = ClassUtils.getAllSuperclasses(CY.class);
+        assertEquals(2, list.size());
+        assertEquals(CX.class, list.get(0));
+        assertEquals(Object.class, list.get(1));
 
-    private interface IA {
-    }
-    private interface IB {
-    }
-    private interface IC extends ID, IE {
+        assertNull(ClassUtils.getAllSuperclasses(null));
     }
-    private interface ID {
-    }
-    private interface IE extends IF {
+    @Test
+    public void test_getPackageCanonicalName_Class() {
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(ClassUtils.class));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(ClassUtils[].class));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(ClassUtils[][].class));
+        assertEquals("", ClassUtils.getPackageCanonicalName(int[].class));
+        assertEquals("", ClassUtils.getPackageCanonicalName(int[][].class));
+
+        // Inner types
+        class Named {}
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new Object(){}.getClass()));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(Named.class));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(Inner.class));
     }
-    private interface IF {
+    @Test
+    public void test_getPackageCanonicalName_Object() {
+        assertEquals("<null>", ClassUtils.getPackageCanonicalName(null, "<null>"));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new ClassUtils(), "<null>"));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new ClassUtils[0], "<null>"));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new ClassUtils[0][0], "<null>"));
+        assertEquals("", ClassUtils.getPackageCanonicalName(new int[0], "<null>"));
+        assertEquals("", ClassUtils.getPackageCanonicalName(new int[0][0], "<null>"));
+
+        // Inner types
+        class Named {}
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new Object(){}, "<null>"));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new Named(), "<null>"));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName(new Inner(), "<null>"));
     }
-    private static class CX implements IB, IA, IE {
+    @Test
+    public void test_getPackageCanonicalName_String() {
+        assertEquals("org.apache.commons.lang3",
+            ClassUtils.getPackageCanonicalName("org.apache.commons.lang3.ClassUtils"));
+        assertEquals("org.apache.commons.lang3",
+            ClassUtils.getPackageCanonicalName("[Lorg.apache.commons.lang3.ClassUtils;"));
+        assertEquals("org.apache.commons.lang3",
+            ClassUtils.getPackageCanonicalName("[[Lorg.apache.commons.lang3.ClassUtils;"));
+        assertEquals("org.apache.commons.lang3",
+            ClassUtils.getPackageCanonicalName("org.apache.commons.lang3.ClassUtils[]"));
+        assertEquals("org.apache.commons.lang3",
+            ClassUtils.getPackageCanonicalName("org.apache.commons.lang3.ClassUtils[][]"));
+        assertEquals("", ClassUtils.getPackageCanonicalName("[I"));
+        assertEquals("", ClassUtils.getPackageCanonicalName("[[I"));
+        assertEquals("", ClassUtils.getPackageCanonicalName("int[]"));
+        assertEquals("", ClassUtils.getPackageCanonicalName("int[][]"));
+
+        // Inner types
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName("org.apache.commons.lang3.ClassUtilsTest$6"));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName("org.apache.commons.lang3.ClassUtilsTest$5Named"));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageCanonicalName("org.apache.commons.lang3.ClassUtilsTest$Inner"));
     }
-    private static class CY extends CX implements IB, IC {
+
+    @Test
+    public void test_getPackageName_Class() {
+        assertEquals("java.lang", ClassUtils.getPackageName(String.class));
+        assertEquals("java.util", ClassUtils.getPackageName(Map.Entry.class));
+        assertEquals("", ClassUtils.getPackageName((Class<?>) null));
+
+        // LANG-535
+        assertEquals("java.lang", ClassUtils.getPackageName(String[].class));
+
+        // Primitive Arrays
+        assertEquals("", ClassUtils.getPackageName(boolean[].class));
+        assertEquals("", ClassUtils.getPackageName(byte[].class));
+        assertEquals("", ClassUtils.getPackageName(char[].class));
+        assertEquals("", ClassUtils.getPackageName(short[].class));
+        assertEquals("", ClassUtils.getPackageName(int[].class));
+        assertEquals("", ClassUtils.getPackageName(long[].class));
+        assertEquals("", ClassUtils.getPackageName(float[].class));
+        assertEquals("", ClassUtils.getPackageName(double[].class));
+
+        // Arrays of arrays of ...
+        assertEquals("java.lang", ClassUtils.getPackageName(String[][].class));
+        assertEquals("java.lang", ClassUtils.getPackageName(String[][][].class));
+        assertEquals("java.lang", ClassUtils.getPackageName(String[][][][].class));
+
+        // On-the-fly types
+        class Named {}
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new Object() {
+        }.getClass()));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(Named.class));
     }
 
     // -------------------------------------------------------------------------
     @Test
-    public void test_convertClassNamesToClasses_List() {
-        final List<String> list = new ArrayList<>();
-        List<Class<?>> result = ClassUtils.convertClassNamesToClasses(list);
-        assertEquals(0, result.size());
-
-        list.add("java.lang.String");
-        list.add("java.lang.xxx");
-        list.add("java.lang.Object");
-        result = ClassUtils.convertClassNamesToClasses(list);
-        assertEquals(3, result.size());
-        assertEquals(String.class, result.get(0));
-        assertNull(result.get(1));
-        assertEquals(Object.class, result.get(2));
+    public void test_getPackageName_Object() {
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new ClassUtils(), "<null>"));
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(new Inner(), "<null>"));
+        assertEquals("<null>", ClassUtils.getPackageName(null, "<null>"));
+    }
 
-        @SuppressWarnings("unchecked") // test what happens when non-generic code adds wrong type of element
-        final
-        List<Object> olist = (List<Object>)(List<?>)list;
-        olist.add(new Object());
-        try {
-            ClassUtils.convertClassNamesToClasses(list);
-            fail("Should not have been able to convert list");
-        } catch (final ClassCastException expected) {}
-        assertNull(ClassUtils.convertClassNamesToClasses(null));
+    @Test
+    public void test_getPackageName_String() {
+        assertEquals("org.apache.commons.lang3", ClassUtils.getPackageName(ClassUtils.class.getName()));
+        assertEquals("java.util", ClassUtils.getPackageName(Map.Entry.class.getName()));
+        assertEquals("", ClassUtils.getPackageName((String) null));
+        assertEquals("", ClassUtils.getPackageName(""));
     }
 
     @Test
-    public void test_convertClassesToClassNames_List() {
-        final List<Class<?>> list = new ArrayList<>();
-        List<String> result = ClassUtils.convertClassesToClassNames(list);
-        assertEquals(0, result.size());
+    public void test_getShortCanonicalName_Class() {
+        assertEquals("ClassUtils", ClassUtils.getShortCanonicalName(ClassUtils.class));
+        assertEquals("ClassUtils[]", ClassUtils.getShortCanonicalName(ClassUtils[].class));
+        assertEquals("ClassUtils[][]", ClassUtils.getShortCanonicalName(ClassUtils[][].class));
+        assertEquals("int[]", ClassUtils.getShortCanonicalName(int[].class));
+        assertEquals("int[][]", ClassUtils.getShortCanonicalName(int[][].class));
 
-        list.add(String.class);
-        list.add(null);
-        list.add(Object.class);
-        result = ClassUtils.convertClassesToClassNames(list);
-        assertEquals(3, result.size());
-        assertEquals("java.lang.String", result.get(0));
-        assertNull(result.get(1));
-        assertEquals("java.lang.Object", result.get(2));
+        // Inner types
+        class Named {}
+        assertEquals("ClassUtilsTest.7", ClassUtils.getShortCanonicalName(new Object(){}.getClass()));
+        assertEquals("ClassUtilsTest.6Named", ClassUtils.getShortCanonicalName(Named.class));
+        assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortCanonicalName(Inner.class));
+    }
 
-        @SuppressWarnings("unchecked") // test what happens when non-generic code adds wrong type of element
-        final
-        List<Object> olist = (List<Object>)(List<?>)list;
-        olist.add(new Object());
-        try {
-            ClassUtils.convertClassesToClassNames(list);
-            fail("Should not have been able to convert list");
-        } catch (final ClassCastException expected) {}
-        assertNull(ClassUtils.convertClassesToClassNames(null));
+    @Test
+    public void test_getShortCanonicalName_Object() {
+        assertEquals("<null>", ClassUtils.getShortCanonicalName(null, "<null>"));
+        assertEquals("ClassUtils", ClassUtils.getShortCanonicalName(new ClassUtils(), "<null>"));
+        assertEquals("ClassUtils[]", ClassUtils.getShortCanonicalName(new ClassUtils[0], "<null>"));
+        assertEquals("ClassUtils[][]", ClassUtils.getShortCanonicalName(new ClassUtils[0][0], "<null>"));
+        assertEquals("int[]", ClassUtils.getShortCanonicalName(new int[0], "<null>"));
+        assertEquals("int[][]", ClassUtils.getShortCanonicalName(new int[0][0], "<null>"));
+
+        // Inner types
+        class Named {}
+        assertEquals("ClassUtilsTest.6", ClassUtils.getShortCanonicalName(new Object(){}, "<null>"));
+        assertEquals("ClassUtilsTest.5Named", ClassUtils.getShortCanonicalName(new Named(), "<null>"));
+        assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortCanonicalName(new Inner(), "<null>"));
     }
 
-    // -------------------------------------------------------------------------
     @Test
-    public void test_isInnerClass_Class() {
-        assertTrue(ClassUtils.isInnerClass(Inner.class));
-        assertTrue(ClassUtils.isInnerClass(Map.Entry.class));
-        assertTrue(ClassUtils.isInnerClass(new Cloneable() {
-        }.getClass()));
-        assertFalse(ClassUtils.isInnerClass(this.getClass()));
-        assertFalse(ClassUtils.isInnerClass(String.class));
-        assertFalse(ClassUtils.isInnerClass(null));
+    public void test_getShortCanonicalName_String() {
+        assertEquals("ClassUtils", ClassUtils.getShortCanonicalName("org.apache.commons.lang3.ClassUtils"));
+        assertEquals("ClassUtils[]", ClassUtils.getShortCanonicalName("[Lorg.apache.commons.lang3.ClassUtils;"));
+        assertEquals("ClassUtils[][]", ClassUtils.getShortCanonicalName("[[Lorg.apache.commons.lang3.ClassUtils;"));
+        assertEquals("ClassUtils[]", ClassUtils.getShortCanonicalName("org.apache.commons.lang3.ClassUtils[]"));
+        assertEquals("ClassUtils[][]", ClassUtils.getShortCanonicalName("org.apache.commons.lang3.ClassUtils[][]"));
+        assertEquals("int[]", ClassUtils.getShortCanonicalName("[I"));
+        assertEquals("int[][]", ClassUtils.getShortCanonicalName("[[I"));
+        assertEquals("int[]", ClassUtils.getShortCanonicalName("int[]"));
+        assertEquals("int[][]", ClassUtils.getShortCanonicalName("int[][]"));
+
+        // Inner types
+        assertEquals("ClassUtilsTest.6", ClassUtils.getShortCanonicalName("org.apache.commons.lang3.ClassUtilsTest$6"));
+        assertEquals("ClassUtilsTest.5Named", ClassUtils.getShortCanonicalName("org.apache.commons.lang3.ClassUtilsTest$5Named"));
+        assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortCanonicalName("org.apache.commons.lang3.ClassUtilsTest$Inner"));
     }
 
-    // -------------------------------------------------------------------------
     @Test
-    public void test_isAssignable_ClassArray_ClassArray() throws Exception {
-        final Class<?>[] array2 = new Class[] {Object.class, Object.class};
-        final Class<?>[] array1 = new Class[] {Object.class};
-        final Class<?>[] array1s = new Class[] {String.class};
-        final Class<?>[] array0 = new Class[] {};
-        final Class<?>[] arrayPrimitives = { Integer.TYPE, Boolean.TYPE };
-        final Class<?>[] arrayWrappers = { Integer.class, Boolean.class };
+    public void test_getShortClassName_Class() {
+        assertEquals("ClassUtils", ClassUtils.getShortClassName(ClassUtils.class));
+        assertEquals("Map.Entry", ClassUtils.getShortClassName(Map.Entry.class));
+        assertEquals("", ClassUtils.getShortClassName((Class<?>) null));
 
-        assertFalse(ClassUtils.isAssignable(array1, array2));
-        assertFalse(ClassUtils.isAssignable(null, array2));
-        assertTrue(ClassUtils.isAssignable(null, array0));
-        assertTrue(ClassUtils.isAssignable(array0, array0));
-        assertTrue(ClassUtils.isAssignable(array0, (Class<?>[]) null)); // explicit cast to avoid warning
-        assertTrue(ClassUtils.isAssignable(null, (Class<?>[]) null)); // explicit cast to avoid warning
+        // LANG-535
+        assertEquals("String[]", ClassUtils.getShortClassName(String[].class));
+        assertEquals("Map.Entry[]", ClassUtils.getShortClassName(Map.Entry[].class));
 
-        assertFalse(ClassUtils.isAssignable(array1, array1s));
-        assertTrue(ClassUtils.isAssignable(array1s, array1s));
-        assertTrue(ClassUtils.isAssignable(array1s, array1));
+        // Primitives
+        assertEquals("boolean", ClassUtils.getShortClassName(boolean.class));
+        assertEquals("byte", ClassUtils.getShortClassName(byte.class));
+        assertEquals("char", ClassUtils.getShortClassName(char.class));
+        assertEquals("short", ClassUtils.getShortClassName(short.class));
+        assertEquals("int", ClassUtils.getShortClassName(int.class));
+        assertEquals("long", ClassUtils.getShortClassName(long.class));
+        assertEquals("float", ClassUtils.getShortClassName(float.class));
+        assertEquals("double", ClassUtils.getShortClassName(double.class));
 
-        assertTrue(ClassUtils.isAssignable(arrayPrimitives, arrayWrappers));
-        assertTrue(ClassUtils.isAssignable(arrayWrappers, arrayPrimitives));
-        assertFalse(ClassUtils.isAssignable(arrayPrimitives, array1));
-        assertFalse(ClassUtils.isAssignable(arrayWrappers, array1));
-        assertTrue(ClassUtils.isAssignable(arrayPrimitives, array2));
-        assertTrue(ClassUtils.isAssignable(arrayWrappers, array2));
+        // Primitive Arrays
+        assertEquals("boolean[]", ClassUtils.getShortClassName(boolean[].class));
+        assertEquals("byte[]", ClassUtils.getShortClassName(byte[].class));
+        assertEquals("char[]", ClassUtils.getShortClassName(char[].class));
+        assertEquals("short[]", ClassUtils.getShortClassName(short[].class));
+        assertEquals("int[]", ClassUtils.getShortClassName(int[].class));
+        assertEquals("long[]", ClassUtils.getShortClassName(long[].class));
+        assertEquals("float[]", ClassUtils.getShortClassName(float[].class));
+        assertEquals("double[]", ClassUtils.getShortClassName(double[].class));
+
+        // Arrays of arrays of ...
+        assertEquals("String[][]", ClassUtils.getShortClassName(String[][].class));
+        assertEquals("String[][][]", ClassUtils.getShortClassName(String[][][].class));
+        assertEquals("String[][][][]", ClassUtils.getShortClassName(String[][][][].class));
+
+        // Inner types
+        class Named {}
+        assertEquals("ClassUtilsTest.2", ClassUtils.getShortClassName(new Object(){}.getClass()));
+        assertEquals("ClassUtilsTest.2Named", ClassUtils.getShortClassName(Named.class));
+        assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(Inner.class));
     }
 
+    // -------------------------------------------------------------------------
     @Test
-    public void test_isAssignable_ClassArray_ClassArray_Autoboxing() throws Exception {
-        final Class<?>[] array2 = new Class[] {Object.class, Object.class};
-        final Class<?>[] array1 = new Class[] {Object.class};
-        final Class<?>[] array1s = new Class[] {String.class};
-        final Class<?>[] array0 = new Class[] {};
-        final Class<?>[] arrayPrimitives = { Integer.TYPE, Boolean.TYPE };
-        final Class<?>[] arrayWrappers = { Integer.class, Boolean.class };
-
-        assertFalse(ClassUtils.isAssignable(array1, array2, true));
-        assertFalse(ClassUtils.isAssignable(null, array2, true));
-        assertTrue(ClassUtils.isAssignable(null, array0, true));
-        assertTrue(ClassUtils.isAssignable(array0, array0, true));
-        assertTrue(ClassUtils.isAssignable(array0, null, true));
-        assertTrue(ClassUtils.isAssignable((Class[]) null, null, true));
+    public void test_getShortClassName_Object() {
+        assertEquals("ClassUtils", ClassUtils.getShortClassName(new ClassUtils(), "<null>"));
+        assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(new Inner(), "<null>"));
+        assertEquals("String", ClassUtils.getShortClassName("hello", "<null>"));
+        assertEquals("<null>", ClassUtils.getShortClassName(null, "<null>"));
 
-        assertFalse(ClassUtils.isAssignable(array1, array1s, true));
-        assertTrue(ClassUtils.isAssignable(array1s, array1s, true));
-        assertTrue(ClassUtils.isAssignable(array1s, array1, true));
+        // Inner types
+        class Named {}
+        assertEquals("ClassUtilsTest.1", ClassUtils.getShortClassName(new Object(){}, "<null>"));
+        assertEquals("ClassUtilsTest.1Named", ClassUtils.getShortClassName(new Named(), "<null>"));
+        assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortClassName(new Inner(), "<null>"));
+    }
 
-        assertTrue(ClassUtils.isAssignable(arrayPrimitives, arrayWrappers, true));
-        assertTrue(ClassUtils.isAssignable(arrayWrappers, arrayPrimitives, true));
-        assertFalse(ClassUtils.isAssignable(arrayPrimitives, array1, true));
-        assertFalse(ClassUtils.isAssignable(arrayWrappers, array1, true));
-        assertTrue(ClassUtils.isAssignable(arrayPrimitives, array2, true));
-        assertTrue(ClassUtils.isAssignable(arrayWrappers, array2, true));
+    @Test
+    public void test_getShortClassName_String() {
+        assertEquals("ClassUtils", ClassUtils.getShortClassName(ClassUtils.class.getName()));
+        assertEquals("Map.Entry", ClassUtils.getShortClassName(Map.Entry.class.getName()));
+        assertEquals("", ClassUtils.getShortClassName((String) null));
+        assertEquals("", ClassUtils.getShortClassName(""));
     }
 
     @Test
-    public void test_isAssignable_ClassArray_ClassArray_NoAutoboxing() throws Exception {
-        final Class<?>[] array2 = new Class[] {Object.class, Object.class};
-        final Class<?>[] array1 = new Class[] {Object.class};
-        final Class<?>[] array1s = new Class[] {String.class};
-        final Class<?>[] array0 = new Class[] {};
-        final Class<?>[] arrayPrimitives = { Integer.TYPE, Boolean.TYPE };
-        final Class<?>[] arrayWrappers = { Integer.class, Boolean.class };
+    public void test_getSimpleName_Class() {
+        assertEquals("ClassUtils", ClassUtils.getSimpleName(ClassUtils.class));
+        assertEquals("Entry", ClassUtils.getSimpleName(Map.Entry.class));
+        assertEquals("", ClassUtils.getSimpleName(null));
 
-        assertFalse(ClassUtils.isAssignable(array1, array2, false));
-        assertFalse(ClassUtils.isAssignable(null, array2, false));
-        assertTrue(ClassUtils.isAssignable(null, array0, false));
-        assertTrue(ClassUtils.isAssignable(array0, array0, false));
-        assertTrue(ClassUtils.isAssignable(array0, null, false));
-        assertTrue(ClassUtils.isAssignable((Class[]) null, null, false));
+        // LANG-535
+        assertEquals("String[]", ClassUtils.getSimpleName(String[].class));
+        assertEquals("Entry[]", ClassUtils.getSimpleName(Map.Entry[].class));
 
-        assertFalse(ClassUtils.isAssignable(array1, array1s, false));
-        assertTrue(ClassUtils.isAssignable(array1s, array1s, false));
-        assertTrue(ClassUtils.isAssignable(array1s, array1, false));
+        // Primitives
+        assertEquals("boolean", ClassUtils.getSimpleName(boolean.class));
+        assertEquals("byte", ClassUtils.getSimpleName(byte.class));
+        assertEquals("char", ClassUtils.getSimpleName(char.class));
+        assertEquals("short", ClassUtils.getSimpleName(short.class));
+        assertEquals("int", ClassUtils.getSimpleName(int.class));
+        assertEquals("long", ClassUtils.getSimpleName(long.class));
+        assertEquals("float", ClassUtils.getSimpleName(float.class));
+        assertEquals("double", ClassUtils.getSimpleName(double.class));
 
-        assertFalse(ClassUtils.isAssignable(arrayPrimitives, arrayWrappers, false));
-        assertFalse(ClassUtils.isAssignable(arrayWrappers, arrayPrimitives, false));
-        assertFalse(ClassUtils.isAssignable(arrayPrimitives, array1, false));
-        assertFalse(ClassUtils.isAssignable(arrayWrappers, array1, false));
-        assertTrue(ClassUtils.isAssignable(arrayWrappers, array2, false));
-        assertFalse(ClassUtils.isAssignable(arrayPrimitives, array2, false));
+        // Primitive Arrays
+        assertEquals("boolean[]", ClassUtils.getSimpleName(boolean[].class));
+        assertEquals("byte[]", ClassUtils.getSimpleName(byte[].class));
+        assertEquals("char[]", ClassUtils.getSimpleName(char[].class));
+        assertEquals("short[]", ClassUtils.getSimpleName(short[].class));
+        assertEquals("int[]", ClassUtils.getSimpleName(int[].class));
+        assertEquals("long[]", ClassUtils.getSimpleName(long[].class));
+        assertEquals("float[]", ClassUtils.getSimpleName(float[].class));
+        assertEquals("double[]", ClassUtils.getSimpleName(double[].class));
+
+        // Arrays of arrays of ...
+        assertEquals("String[][]", ClassUtils.getSimpleName(String[][].class));
+        assertEquals("String[][][]", ClassUtils.getSimpleName(String[][][].class));
+        assertEquals("String[][][][]", ClassUtils.getSimpleName(String[][][][].class));
+
+        // On-the-fly types
+        class Named {}
+        assertEquals("", ClassUtils.getSimpleName(new Object(){}.getClass()));
+        assertEquals("Named", ClassUtils.getSimpleName(Named.class));
+    }
+
+    @Test
+    public void test_getSimpleName_Object() {
+        assertEquals("ClassUtils", ClassUtils.getSimpleName(new ClassUtils(), "<null>"));
+        assertEquals("Inner", ClassUtils.getSimpleName(new Inner(), "<null>"));
+        assertEquals("String", ClassUtils.getSimpleName("hello", "<null>"));
+        assertEquals("<null>", ClassUtils.getSimpleName(null, "<null>"));
     }
 
     @Test
@@ -498,111 +514,89 @@ public class ClassUtilsTest  {
         assertTrue(ClassUtils.isAssignable(Boolean.class, Boolean.class, true));
     }
 
+    // -------------------------------------------------------------------------
     @Test
-    public void test_isAssignable_NoAutoboxing() throws Exception {
-        assertFalse(ClassUtils.isAssignable((Class<?>) null, null, false));
-        assertFalse(ClassUtils.isAssignable(String.class, null, false));
+    public void test_isAssignable_ClassArray_ClassArray() throws Exception {
+        final Class<?>[] array2 = new Class[] {Object.class, Object.class};
+        final Class<?>[] array1 = new Class[] {Object.class};
+        final Class<?>[] array1s = new Class[] {String.class};
+        final Class<?>[] array0 = new Class[] {};
+        final Class<?>[] arrayPrimitives = { Integer.TYPE, Boolean.TYPE };
+        final Class<?>[] arrayWrappers = { Integer.class, Boolean.class };
 
-        assertTrue(ClassUtils.isAssignable(null, Object.class, false));
-        assertTrue(ClassUtils.isAssignable(null, Integer.class, false));
-        assertFalse(ClassUtils.isAssignable(null, Integer.TYPE, false));
-        assertTrue(ClassUtils.isAssignable(String.class, Object.class, false));
-        assertTrue(ClassUtils.isAssignable(String.class, String.class, false));
-        assertFalse(ClassUtils.isAssignable(Object.class, String.class, false));
-        assertFalse(ClassUtils.isAssignable(Integer.TYPE, Integer.class, false));
-        assertFalse(ClassUtils.isAssignable(Integer.TYPE, Object.class, false));
-        assertFalse(ClassUtils.isAssignable(Integer.class, Integer.TYPE, false));
-        assertTrue(ClassUtils.isAssignable(Integer.TYPE, Integer.TYPE, false));
-        assertTrue(ClassUtils.isAssignable(Integer.class, Integer.class, false));
-        assertFalse(ClassUtils.isAssignable(Boolean.TYPE, Boolean.class, false));
-        assertFalse(ClassUtils.isAssignable(Boolean.TYPE, Object.class, false));
-        assertFalse(ClassUtils.isAssignable(Boolean.class, Boolean.TYPE, false));
-        assertTrue(ClassUtils.isAssignable(Boolean.class, Object.class, false));
-        assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE, false));
-        assertTrue(ClassUtils.isAssignable(Boolean.class, Boolean.class, false));
+        assertFalse(ClassUtils.isAssignable(array1, array2));
+        assertFalse(ClassUtils.isAssignable(null, array2));
+        assertTrue(ClassUtils.isAssignable(null, array0));
+        assertTrue(ClassUtils.isAssignable(array0, array0));
+        assertTrue(ClassUtils.isAssignable(array0, (Class<?>[]) null)); // explicit cast to avoid warning
+        assertTrue(ClassUtils.isAssignable(null, (Class<?>[]) null)); // explicit cast to avoid warning
+
+        assertFalse(ClassUtils.isAssignable(array1, array1s));
+        assertTrue(ClassUtils.isAssignable(array1s, array1s));
+        assertTrue(ClassUtils.isAssignable(array1s, array1));
+
+        assertTrue(ClassUtils.isAssignable(arrayPrimitives, arrayWrappers));
+        assertTrue(ClassUtils.isAssignable(arrayWrappers, arrayPrimitives));
+        assertFalse(ClassUtils.isAssignable(arrayPrimitives, array1));
+        assertFalse(ClassUtils.isAssignable(arrayWrappers, array1));
+        assertTrue(ClassUtils.isAssignable(arrayPrimitives, array2));
+        assertTrue(ClassUtils.isAssignable(arrayWrappers, array2));
     }
 
     @Test
-    public void test_isAssignable_Widening() throws Exception {
-        // test byte conversions
-        assertFalse("byte -> char", ClassUtils.isAssignable(Byte.TYPE, Character.TYPE));
-        assertTrue("byte -> byte", ClassUtils.isAssignable(Byte.TYPE, Byte.TYPE));
-        assertTrue("byte -> short", ClassUtils.isAssignable(Byte.TYPE, Short.TYPE));
-        assertTrue("byte -> int", ClassUtils.isAssignable(Byte.TYPE, Integer.TYPE));
-        assertTrue("byte -> long", ClassUtils.isAssignable(Byte.TYPE, Long.TYPE));
-        assertTrue("byte -> float", ClassUtils.isAssignable(Byte.TYPE, Float.TYPE));
-        assertTrue("byte -> double", ClassUtils.isAssignable(Byte.TYPE, Double.TYPE));
-        assertFalse("byte -> boolean", ClassUtils.isAssignable(Byte.TYPE, Boolean.TYPE));
-
-        // test short conversions
-        assertFalse("short -> char", ClassUtils.isAssignable(Short.TYPE, Character.TYPE));
-        assertFalse("short -> byte", ClassUtils.isAssignable(Short.TYPE, Byte.TYPE));
-        assertTrue("short -> short", ClassUtils.isAssignable(Short.TYPE, Short.TYPE));
-        assertTrue("short -> int", ClassUtils.isAssignable(Short.TYPE, Integer.TYPE));
-        assertTrue("short -> long", ClassUtils.isAssignable(Short.TYPE, Long.TYPE));
-        assertTrue("short -> float", ClassUtils.isAssignable(Short.TYPE, Float.TYPE));
-        assertTrue("short -> double", ClassUtils.isAssignable(Short.TYPE, Double.TYPE));
-        assertFalse("short -> boolean", ClassUtils.isAssignable(Short.TYPE, Boolean.TYPE));
+    public void test_isAssignable_ClassArray_ClassArray_Autoboxing() throws Exception {
+        final Class<?>[] array2 = new Class[] {Object.class, Object.class};
+        final Class<?>[] array1 = new Class[] {Object.class};
+        final Class<?>[] array1s = new Class[] {String.class};
+        final Class<?>[] array0 = new Class[] {};
+        final Class<?>[] arrayPrimitives = { Integer.TYPE, Boolean.TYPE };
+        final Class<?>[] arrayWrappers = { Integer.class, Boolean.class };
 
-        // test char conversions
-        assertTrue("char -> char", ClassUtils.isAssignable(Character.TYPE, Character.TYPE));
-        assertFalse("char -> byte", ClassUtils.isAssignable(Character.TYPE, Byte.TYPE));
-        assertFalse("char -> short", ClassUtils.isAssignable(Character.TYPE, Short.TYPE));
-        assertTrue("char -> int", ClassUtils.isAssignable(Character.TYPE, Integer.TYPE));
-        assertTrue("char -> long", ClassUtils.isAssignable(Character.TYPE, Long.TYPE));
-        assertTrue("char -> float", ClassUtils.isAssignable(Character.TYPE, Float.TYPE));
-        assertTrue("char -> double", ClassUtils.isAssignable(Character.TYPE, Double.TYPE));
-        assertFalse("char -> boolean", ClassUtils.isAssignable(Character.TYPE, Boolean.TYPE));
+        assertFalse(ClassUtils.isAssignable(array1, array2, true));
+        assertFalse(ClassUtils.isAssignable(null, array2, true));
+        assertTrue(ClassUtils.isAssignable(null, array0, true));
+        assertTrue(ClassUtils.isAssignable(array0, array0, true));
+        assertTrue(ClassUtils.isAssignable(array0, null, true));
+        assertTrue(ClassUtils.isAssignable((Class[]) null, null, true));
 
-        // test int conversions
-        assertFalse("int -> char", ClassUtils.isAssignable(Integer.TYPE, Character.TYPE));
-        assertFalse("int -> byte", ClassUtils.isAssignable(Integer.TYPE, Byte.TYPE));
-        assertFalse("int -> short", ClassUtils.isAssignable(Integer.TYPE, Short.TYPE));
-        assertTrue("int -> int", ClassUtils.isAssignable(Integer.TYPE, Integer.TYPE));
-        assertTrue("int -> long", ClassUtils.isAssignable(Integer.TYPE, Long.TYPE));
-        assertTrue("int -> float", ClassUtils.isAssignable(Integer.TYPE, Float.TYPE));
-        assertTrue("int -> double", ClassUtils.isAssignable(Integer.TYPE, Double.TYPE));
-        assertFalse("int -> boolean", ClassUtils.isAssignable(Integer.TYPE, Boolean.TYPE));
+        assertFalse(ClassUtils.isAssignable(array1, array1s, true));
+        assertTrue(ClassUtils.isAssignable(array1s, array1s, true));
+        assertTrue(ClassUtils.isAssignable(array1s, array1, true));
 
-        // test long conversions
-        assertFalse("long -> char", ClassUtils.isAssignable(Long.TYPE, Character.TYPE));
-        assertFalse("long -> byte", ClassUtils.isAssignable(Long.TYPE, Byte.TYPE));
-        assertFalse("long -> short", ClassUtils.isAssignable(Long.TYPE, Short.TYPE));
-        assertFalse("long -> int", ClassUtils.isAssignable(Long.TYPE, Integer.TYPE));
-        assertTrue("long -> long", ClassUtils.isAssignable(Long.TYPE, Long.TYPE));
-        assertTrue("long -> float", ClassUtils.isAssignable(Long.TYPE, Float.TYPE));
-        assertTrue("long -> double", ClassUtils.isAssignable(Long.TYPE, Double.TYPE));
-        assertFalse("long -> boolean", ClassUtils.isAssignable(Long.TYPE, Boolean.TYPE));
+        assertTrue(ClassUtils.isAssignable(arrayPrimitives, arrayWrappers, true));
+        assertTrue(ClassUtils.isAssignable(arrayWrappers, arrayPrimitives, true));
+        assertFalse(ClassUtils.isAssignable(arrayPrimitives, array1, true));
+        assertFalse(ClassUtils.isAssignable(arrayWrappers, array1, true));
+        assertTrue(ClassUtils.isAssignable(arrayPrimitives, array2, true));
+        assertTrue(ClassUtils.isAssignable(arrayWrappers, array2, true));
+    }
 
-        // test float conversions
-        assertFalse("float -> char", ClassUtils.isAssignable(Float.TYPE, Character.TYPE));
-        assertFalse("float -> byte", ClassUtils.isAssignable(Float.TYPE, Byte.TYPE));
-        assertFalse("float -> short", ClassUtils.isAssignable(Float.TYPE, Short.TYPE));
-        assertFalse("float -> int", ClassUtils.isAssignable(Float.TYPE, Integer.TYPE));
-        assertFalse("float -> long", ClassUtils.isAssignable(Float.TYPE, Long.TYPE));
-        assertTrue("float -> float", ClassUtils.isAssignable(Float.TYPE, Float.TYPE));
-        assertTrue("float -> double", ClassUtils.isAssignable(Float.TYPE, Double.TYPE));
-        assertFalse("float -> boolean", ClassUtils.isAssignable(Float.TYPE, Boolean.TYPE));
+    @Test
+    public void test_isAssignable_ClassArray_ClassArray_NoAutoboxing() throws Exception {
+        final Class<?>[] array2 = new Class[] {Object.class, Object.class};
+        final Class<?>[] array1 = new Class[] {Object.class};
+        final Class<?>[] array1s = new Class[] {String.class};
+        final Class<?>[] array0 = new Class[] {};
+        final Class<?>[] arrayPrimitives = { Integer.TYPE, Boolean.TYPE };
+        final Class<?>[] arrayWrappers = { Integer.class, Boolean.class };
 
-        // test double conversions
-        assertFalse("double -> char", ClassUtils.isAssignable(Double.TYPE, Character.TYPE));
-        assertFalse("double -> byte", ClassUtils.isAssignable(Double.TYPE, Byte.TYPE));
-        assertFalse("double -> short", ClassUtils.isAssignable(Double.TYPE, Short.TYPE));
-        assertFalse("double -> int", ClassUtils.isAssignable(Double.TYPE, Integer.TYPE));
-        assertFalse("double -> long", ClassUtils.isAssignable(Double.TYPE, Long.TYPE));
-        assertFalse("double -> float", ClassUtils.isAssignable(Double.TYPE, Float.TYPE));
-        assertTrue("double -> double", ClassUtils.isAssignable(Double.TYPE, Double.TYPE));
-        assertFalse("double -> boolean", ClassUtils.isAssignable(Double.TYPE, Boolean.TYPE));
+        assertFalse(ClassUtils.isAssignable(array1, array2, false));
+        assertFalse(ClassUtils.isAssignable(null, array2, false));
+        assertTrue(ClassUtils.isAssignable(null, array0, false));
+        assertTrue(ClassUtils.isAssignable(array0, array0, false));
+        assertTrue(ClassUtils.isAssignable(array0, null, false));
+        assertTrue(ClassUtils.isAssignable((Class[]) null, null, false));
 
-        // test boolean conversions
-        assertFalse("boolean -> char", ClassUtils.isAssignable(Boolean.TYPE, Character.TYPE));
-        assertFalse("boolean -> byte", ClassUtils.isAssignable(Boolean.TYPE, Byte.TYPE));
-        assertFalse("boolean -> short", ClassUtils.isAssignable(Boolean.TYPE, Short.TYPE));
-        assertFalse("boolean -> int", ClassUtils.isAssignable(Boolean.TYPE, Integer.TYPE));
-        assertFalse("boolean -> long", ClassUtils.isAssignable(Boolean.TYPE, Long.TYPE));
-        assertFalse("boolean -> float", ClassUtils.isAssignable(Boolean.TYPE, Float.TYPE));
-        assertFalse("boolean -> double", ClassUtils.isAssignable(Boolean.TYPE, Double.TYPE));
-        assertTrue("boolean -> boolean", ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE));
+        assertFalse(ClassUtils.isAssignable(array1, array1s, false));
+        assertTrue(ClassUtils.isAssignable(array1s, array1s, false));
+        assertTrue(ClassUtils.isAssignable(array1s, array1, false));
+
+        assertFalse(ClassUtils.isAssignable(arrayPrimitives, arrayWrappers, false));
+        assertFalse(ClassUtils.isAssignable(arrayWrappers, arrayPrimitives, false));
+        assertFalse(ClassUtils.isAssignable(arrayPrimitives, array1, false));
+        assertFalse(ClassUtils.isAssignable(arrayWrappers, array1, false));
+        assertTrue(ClassUtils.isAssignable(arrayWrappers, array2, false));
+        assertFalse(ClassUtils.isAssignable(arrayPrimitives, array2, false));
     }
 
     @Test
@@ -689,6 +683,30 @@ public class ClassUtilsTest  {
     }
 
     @Test
+    public void test_isAssignable_NoAutoboxing() throws Exception {
+        assertFalse(ClassUtils.isAssignable((Class<?>) null, null, false));
+        assertFalse(ClassUtils.isAssignable(String.class, null, false));
+
+        assertTrue(ClassUtils.isAssignable(null, Object.class, false));
+        assertTrue(ClassUtils.isAssignable(null, Integer.class, false));
+        assertFalse(ClassUtils.isAssignable(null, Integer.TYPE, false));
+        assertTrue(ClassUtils.isAssignable(String.class, Object.class, false));
+        assertTrue(ClassUtils.isAssignable(String.class, String.class, false));
+        assertFalse(ClassUtils.isAssignable(Object.class, String.class, false));
+        assertFalse(ClassUtils.isAssignable(Integer.TYPE, Integer.class, false));
+        assertFalse(ClassUtils.isAssignable(Integer.TYPE, Object.class, false));
+        assertFalse(ClassUtils.isAssignable(Integer.class, Integer.TYPE, false));
+        assertTrue(ClassUtils.isAssignable(Integer.TYPE, Integer.TYPE, false));
+        assertTrue(ClassUtils.isAssignable(Integer.class, Integer.class, false));
+        assertFalse(ClassUtils.isAssignable(Boolean.TYPE, Boolean.class, false));
+        assertFalse(ClassUtils.isAssignable(Boolean.TYPE, Object.class, false));
+        assertFalse(ClassUtils.isAssignable(Boolean.class, Boolean.TYPE, false));
+        assertTrue(ClassUtils.isAssignable(Boolean.class, Object.class, false));
+        assertTrue(ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE, false));
+        assertTrue(ClassUtils.isAssignable(Boolean.class, Boolean.class, false));
+    }
+
+    @Test
     public void test_isAssignable_Unboxing_Widening() throws Exception {
         // test byte conversions
         assertFalse("byte -> char", ClassUtils.isAssignable(Byte.class, Character.TYPE, true));
@@ -760,15 +778,254 @@ public class ClassUtilsTest  {
         assertTrue("double -> double", ClassUtils.isAssignable(Double.class, Double.TYPE, true));
         assertFalse("double -> boolean", ClassUtils.isAssignable(Double.class, Boolean.TYPE, true));
 
-        // test boolean conversions
-        assertFalse("boolean -> char", ClassUtils.isAssignable(Boolean.class, Character.TYPE, true));
-        assertFalse("boolean -> byte", ClassUtils.isAssignable(Boolean.class, Byte.TYPE, true));
-        assertFalse("boolean -> short", ClassUtils.isAssignable(Boolean.class, Short.TYPE, true));
-        assertFalse("boolean -> int", ClassUtils.isAssignable(Boolean.class, Integer.TYPE, true));
-        assertFalse("boolean -> long", ClassUtils.isAssignable(Boolean.class, Long.TYPE, true));
-        assertFalse("boolean -> float", ClassUtils.isAssignable(Boolean.class, Float.TYPE, true));
-        assertFalse("boolean -> double", ClassUtils.isAssignable(Boolean.class, Double.TYPE, true));
-        assertTrue("boolean -> boolean", ClassUtils.isAssignable(Boolean.class, Boolean.TYPE, true));
+        // test boolean conversions
+        assertFalse("boolean -> char", ClassUtils.isAssignable(Boolean.class, Character.TYPE, true));
+        assertFalse("boolean -> byte", ClassUtils.isAssignable(Boolean.class, Byte.TYPE, true));
+        assertFalse("boolean -> short", ClassUtils.isAssignable(Boolean.class, Short.TYPE, true));
+        assertFalse("boolean -> int", ClassUtils.isAssignable(Boolean.class, Integer.TYPE, true));
+        assertFalse("boolean -> long", ClassUtils.isAssignable(Boolean.class, Long.TYPE, true));
+        assertFalse("boolean -> float", ClassUtils.isAssignable(Boolean.class, Float.TYPE, true));
+        assertFalse("boolean -> double", ClassUtils.isAssignable(Boolean.class, Double.TYPE, true));
+        assertTrue("boolean -> boolean", ClassUtils.isAssignable(Boolean.class, Boolean.TYPE, true));
+    }
+
+    @Test
+    public void test_isAssignable_Widening() throws Exception {
+        // test byte conversions
+        assertFalse("byte -> char", ClassUtils.isAssignable(Byte.TYPE, Character.TYPE));
+        assertTrue("byte -> byte", ClassUtils.isAssignable(Byte.TYPE, Byte.TYPE));
+        assertTrue("byte -> short", ClassUtils.isAssignable(Byte.TYPE, Short.TYPE));
+        assertTrue("byte -> int", ClassUtils.isAssignable(Byte.TYPE, Integer.TYPE));
+        assertTrue("byte -> long", ClassUtils.isAssignable(Byte.TYPE, Long.TYPE));
+        assertTrue("byte -> float", ClassUtils.isAssignable(Byte.TYPE, Float.TYPE));
+        assertTrue("byte -> double", ClassUtils.isAssignable(Byte.TYPE, Double.TYPE));
+        assertFalse("byte -> boolean", ClassUtils.isAssignable(Byte.TYPE, Boolean.TYPE));
+
+        // test short conversions
+        assertFalse("short -> char", ClassUtils.isAssignable(Short.TYPE, Character.TYPE));
+        assertFalse("short -> byte", ClassUtils.isAssignable(Short.TYPE, Byte.TYPE));
+        assertTrue("short -> short", ClassUtils.isAssignable(Short.TYPE, Short.TYPE));
+        assertTrue("short -> int", ClassUtils.isAssignable(Short.TYPE, Integer.TYPE));
+        assertTrue("short -> long", ClassUtils.isAssignable(Short.TYPE, Long.TYPE));
+        assertTrue("short -> float", ClassUtils.isAssignable(Short.TYPE, Float.TYPE));
+        assertTrue("short -> double", ClassUtils.isAssignable(Short.TYPE, Double.TYPE));
+        assertFalse("short -> boolean", ClassUtils.isAssignable(Short.TYPE, Boolean.TYPE));
+
+        // test char conversions
+        assertTrue("char -> char", ClassUtils.isAssignable(Character.TYPE, Character.TYPE));
+        assertFalse("char -> byte", ClassUtils.isAssignable(Character.TYPE, Byte.TYPE));
+        assertFalse("char -> short", ClassUtils.isAssignable(Character.TYPE, Short.TYPE));
+        assertTrue("char -> int", ClassUtils.isAssignable(Character.TYPE, Integer.TYPE));
+        assertTrue("char -> long", ClassUtils.isAssignable(Character.TYPE, Long.TYPE));
+        assertTrue("char -> float", ClassUtils.isAssignable(Character.TYPE, Float.TYPE));
+        assertTrue("char -> double", ClassUtils.isAssignable(Character.TYPE, Double.TYPE));
+        assertFalse("char -> boolean", ClassUtils.isAssignable(Character.TYPE, Boolean.TYPE));
+
+        // test int conversions
+        assertFalse("int -> char", ClassUtils.isAssignable(Integer.TYPE, Character.TYPE));
+        assertFalse("int -> byte", ClassUtils.isAssignable(Integer.TYPE, Byte.TYPE));
+        assertFalse("int -> short", ClassUtils.isAssignable(Integer.TYPE, Short.TYPE));
+        assertTrue("int -> int", ClassUtils.isAssignable(Integer.TYPE, Integer.TYPE));
+        assertTrue("int -> long", ClassUtils.isAssignable(Integer.TYPE, Long.TYPE));
+        assertTrue("int -> float", ClassUtils.isAssignable(Integer.TYPE, Float.TYPE));
+        assertTrue("int -> double", ClassUtils.isAssignable(Integer.TYPE, Double.TYPE));
+        assertFalse("int -> boolean", ClassUtils.isAssignable(Integer.TYPE, Boolean.TYPE));
+
+        // test long conversions
+        assertFalse("long -> char", ClassUtils.isAssignable(Long.TYPE, Character.TYPE));
+        assertFalse("long -> byte", ClassUtils.isAssignable(Long.TYPE, Byte.TYPE));
+        assertFalse("long -> short", ClassUtils.isAssignable(Long.TYPE, Short.TYPE));
+        assertFalse("long -> int", ClassUtils.isAssignable(Long.TYPE, Integer.TYPE));
+        assertTrue("long -> long", ClassUtils.isAssignable(Long.TYPE, Long.TYPE));
+        assertTrue("long -> float", ClassUtils.isAssignable(Long.TYPE, Float.TYPE));
+        assertTrue("long -> double", ClassUtils.isAssignable(Long.TYPE, Double.TYPE));
+        assertFalse("long -> boolean", ClassUtils.isAssignable(Long.TYPE, Boolean.TYPE));
+
+        // test float conversions
+        assertFalse("float -> char", ClassUtils.isAssignable(Float.TYPE, Character.TYPE));
+        assertFalse("float -> byte", ClassUtils.isAssignable(Float.TYPE, Byte.TYPE));
+        assertFalse("float -> short", ClassUtils.isAssignable(Float.TYPE, Short.TYPE));
+        assertFalse("float -> int", ClassUtils.isAssignable(Float.TYPE, Integer.TYPE));
+        assertFalse("float -> long", ClassUtils.isAssignable(Float.TYPE, Long.TYPE));
+        assertTrue("float -> float", ClassUtils.isAssignable(Float.TYPE, Float.TYPE));
+        assertTrue("float -> double", ClassUtils.isAssignable(Float.TYPE, Double.TYPE));
+        assertFalse("float -> boolean", ClassUtils.isAssignable(Float.TYPE, Boolean.TYPE));
+
+        // test double conversions
+        assertFalse("double -> char", ClassUtils.isAssignable(Double.TYPE, Character.TYPE));
+        assertFalse("double -> byte", ClassUtils.isAssignable(Double.TYPE, Byte.TYPE));
+        assertFalse("double -> short", ClassUtils.isAssignable(Double.TYPE, Short.TYPE));
+        assertFalse("double -> int", ClassUtils.isAssignable(Double.TYPE, Integer.TYPE));
+        assertFalse("double -> long", ClassUtils.isAssignable(Double.TYPE, Long.TYPE));
+        assertFalse("double -> float", ClassUtils.isAssignable(Double.TYPE, Float.TYPE));
+        assertTrue("double -> double", ClassUtils.isAssignable(Double.TYPE, Double.TYPE));
+        assertFalse("double -> boolean", ClassUtils.isAssignable(Double.TYPE, Boolean.TYPE));
+
+        // test boolean conversions
+        assertFalse("boolean -> char", ClassUtils.isAssignable(Boolean.TYPE, Character.TYPE));
+        assertFalse("boolean -> byte", ClassUtils.isAssignable(Boolean.TYPE, Byte.TYPE));
+        assertFalse("boolean -> short", ClassUtils.isAssignable(Boolean.TYPE, Short.TYPE));
+        assertFalse("boolean -> int", ClassUtils.isAssignable(Boolean.TYPE, Integer.TYPE));
+        assertFalse("boolean -> long", ClassUtils.isAssignable(Boolean.TYPE, Long.TYPE));
+        assertFalse("boolean -> float", ClassUtils.isAssignable(Boolean.TYPE, Float.TYPE));
+        assertFalse("boolean -> double", ClassUtils.isAssignable(Boolean.TYPE, Double.TYPE));
+        assertTrue("boolean -> boolean", ClassUtils.isAssignable(Boolean.TYPE, Boolean.TYPE));
+    }
+
+    // -------------------------------------------------------------------------
+    @Test
+    public void test_isInnerClass_Class() {
+        assertTrue(ClassUtils.isInnerClass(Inner.class));
+        assertTrue(ClassUtils.isInnerClass(Map.Entry.class));
+        assertTrue(ClassUtils.isInnerClass(new Cloneable() {
+        }.getClass()));
+        assertFalse(ClassUtils.isInnerClass(this.getClass()));
+        assertFalse(ClassUtils.isInnerClass(String.class));
+        assertFalse(ClassUtils.isInnerClass(null));
+    }
+
+    //-----------------------------------------------------------------------
+    @Test
+    public void testConstructor() {
+        assertNotNull(new ClassUtils());
+        final Constructor<?>[] cons = ClassUtils.class.getDeclaredConstructors();
+        assertEquals(1, cons.length);
+        assertTrue(Modifier.isPublic(cons[0].getModifiers()));
+        assertTrue(Modifier.isPublic(ClassUtils.class.getModifiers()));
+        assertFalse(Modifier.isFinal(ClassUtils.class.getModifiers()));
+    }
+
+    @Test
+    public void testGetClassByNormalNameArrays() throws ClassNotFoundException {
+        assertEquals( int[].class, ClassUtils.getClass( "int[]" ) );
+        assertEquals( long[].class, ClassUtils.getClass( "long[]" ) );
+        assertEquals( short[].class, ClassUtils.getClass( "short[]" ) );
+        assertEquals( byte[].class, ClassUtils.getClass( "byte[]" ) );
+        assertEquals( char[].class, ClassUtils.getClass( "char[]" ) );
+        assertEquals( float[].class, ClassUtils.getClass( "float[]" ) );
+        assertEquals( double[].class, ClassUtils.getClass( "double[]" ) );
+        assertEquals( boolean[].class, ClassUtils.getClass( "boolean[]" ) );
+        assertEquals( String[].class, ClassUtils.getClass( "java.lang.String[]" ) );
+        assertEquals( java.util.Map.Entry[].class, ClassUtils.getClass( "java.util.Map.Entry[]" ) );
+        assertEquals( java.util.Map.Entry[].class, ClassUtils.getClass( "java.util.Map$Entry[]" ) );
+        assertEquals( java.util.Map.Entry[].class, ClassUtils.getClass( "[Ljava.util.Map.Entry;" ) );
+        assertEquals( java.util.Map.Entry[].class, ClassUtils.getClass( "[Ljava.util.Map$Entry;" ) );
+    }
+
+    @Test
+    public void testGetClassByNormalNameArrays2D() throws ClassNotFoundException {
+        assertEquals( int[][].class, ClassUtils.getClass( "int[][]" ) );
+        assertEquals( long[][].class, ClassUtils.getClass( "long[][]" ) );
+        assertEquals( short[][].class, ClassUtils.getClass( "short[][]" ) );
+        assertEquals( byte[][].class, ClassUtils.getClass( "byte[][]" ) );
+        assertEquals( char[][].class, ClassUtils.getClass( "char[][]" ) );
+        assertEquals( float[][].class, ClassUtils.getClass( "float[][]" ) );
+        assertEquals( double[][].class, ClassUtils.getClass( "double[][]" ) );
+        assertEquals( boolean[][].class, ClassUtils.getClass( "boolean[][]" ) );
+        assertEquals( String[][].class, ClassUtils.getClass( "java.lang.String[][]" ) );
+    }
+
+    @Test
+    public void testGetClassClassNotFound() throws Exception {
+        assertGetClassThrowsClassNotFound( "bool" );
+        assertGetClassThrowsClassNotFound( "bool[]" );
+        assertGetClassThrowsClassNotFound( "integer[]" );
+    }
+
+    @Test
+    public void testGetClassInvalidArguments() throws Exception {
+        assertGetClassThrowsNullPointerException( null );
+        assertGetClassThrowsClassNotFound( "[][][]" );
+        assertGetClassThrowsClassNotFound( "[[]" );
+        assertGetClassThrowsClassNotFound( "[" );
+        assertGetClassThrowsClassNotFound( "java.lang.String][" );
+        assertGetClassThrowsClassNotFound( ".hello.world" );
+        assertGetClassThrowsClassNotFound( "hello..world" );
+    }
+
+    @Test
+    public void testGetClassRawPrimitives() throws ClassNotFoundException {
+        assertEquals( int.class, ClassUtils.getClass( "int" ) );
+        assertEquals( long.class, ClassUtils.getClass( "long" ) );
+        assertEquals( short.class, ClassUtils.getClass( "short" ) );
+        assertEquals( byte.class, ClassUtils.getClass( "byte" ) );
+        assertEquals( char.class, ClassUtils.getClass( "char" ) );
+        assertEquals( float.class, ClassUtils.getClass( "float" ) );
+        assertEquals( double.class, ClassUtils.getClass( "double" ) );
+        assertEquals( boolean.class, ClassUtils.getClass( "boolean" ) );
+        assertEquals( void.class, ClassUtils.getClass( "void" ) );
+    }
+
+    @Test
+    public void testGetClassWithArrayClasses() throws Exception {
+        assertGetClassReturnsClass( String[].class );
+        assertGetClassReturnsClass( int[].class );
+        assertGetClassReturnsClass( long[].class );
+        assertGetClassReturnsClass( short[].class );
+        assertGetClassReturnsClass( byte[].class );
+        assertGetClassReturnsClass( char[].class );
+        assertGetClassReturnsClass( float[].class );
+        assertGetClassReturnsClass( double[].class );
+        assertGetClassReturnsClass( boolean[].class );
+    }
+
+    @Test
+    public void testGetClassWithArrayClasses2D() throws Exception {
+        assertGetClassReturnsClass( String[][].class );
+        assertGetClassReturnsClass( int[][].class );
+        assertGetClassReturnsClass( long[][].class );
+        assertGetClassReturnsClass( short[][].class );
+        assertGetClassReturnsClass( byte[][].class );
+        assertGetClassReturnsClass( char[][].class );
+        assertGetClassReturnsClass( float[][].class );
+        assertGetClassReturnsClass( double[][].class );
+        assertGetClassReturnsClass( boolean[][].class );
+    }
+
+    @Test
+    public void testGetInnerClass() throws ClassNotFoundException {
+        assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest.Inner.DeeplyNested" ) );
+        assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest.Inner$DeeplyNested" ) );
+        assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest$Inner$DeeplyNested" ) );
+        assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest$Inner.DeeplyNested" ) );
+    }
+
+    @Test
+    public void testGetPublicMethod() throws Exception {
+        // Tests with Collections$UnmodifiableSet
+        final Set<?> set = Collections.unmodifiableSet(new HashSet<>());
+        final Method isEmptyMethod = ClassUtils.getPublicMethod(set.getClass(), "isEmpty");
+            assertTrue(Modifier.isPublic(isEmptyMethod.getDeclaringClass().getModifiers()));
+
+        try {
+            isEmptyMethod.invoke(set);
+        } catch(final java.lang.IllegalAccessException iae) {
+            fail("Should not have thrown IllegalAccessException");
+        }
+
+        // Tests with a public Class
+        final Method toStringMethod = ClassUtils.getPublicMethod(Object.class, "toString");
+            assertEquals(Object.class.getMethod("toString", new Class[0]), toStringMethod);
+    }
+
+    @Test
+    public void testHierarchyExcludingInterfaces() {
+        final Iterator<Class<?>> iter = ClassUtils.hierarchy(StringParameterizedChild.class).iterator();
+        assertEquals(StringParameterizedChild.class, iter.next());
+        assertEquals(GenericParent.class, iter.next());
+        assertEquals(Object.class, iter.next());
+        assertFalse(iter.hasNext());
+    }
+
+    @Test
+    public void testHierarchyIncludingInterfaces() {
+        final Iterator<Class<?>> iter =
+            ClassUtils.hierarchy(StringParameterizedChild.class, Interfaces.INCLUDE).iterator();
+        assertEquals(StringParameterizedChild.class, iter.next());
+        assertEquals(GenericParent.class, iter.next());
+        assertEquals(GenericConsumer.class, iter.next());
+        assertEquals(Object.class, iter.next());
+        assertFalse(iter.hasNext());
     }
 
     @Test
@@ -830,263 +1087,79 @@ public class ClassUtilsTest  {
         assertFalse("Void.class", ClassUtils.isPrimitiveWrapper(Void.class));
         assertFalse("Void.TYPE", ClassUtils.isPrimitiveWrapper(Void.TYPE));
         assertFalse("String.class", ClassUtils.isPrimitiveWrapper(String.class));
-        assertFalse("this.getClass()", ClassUtils.isPrimitiveWrapper(this.getClass()));
-    }
-
-    @Test
-    public void testPrimitiveToWrapper() {
-
-        // test primitive classes
-        assertEquals("boolean -> Boolean.class",
-            Boolean.class, ClassUtils.primitiveToWrapper(Boolean.TYPE));
-        assertEquals("byte -> Byte.class",
-            Byte.class, ClassUtils.primitiveToWrapper(Byte.TYPE));
-        assertEquals("char -> Character.class",
-            Character.class, ClassUtils.primitiveToWrapper(Character.TYPE));
-        assertEquals("short -> Short.class",
-            Short.class, ClassUtils.primitiveToWrapper(Short.TYPE));
-        assertEquals("int -> Integer.class",
-            Integer.class, ClassUtils.primitiveToWrapper(Integer.TYPE));
-        assertEquals("long -> Long.class",
-            Long.class, ClassUtils.primitiveToWrapper(Long.TYPE));
-        assertEquals("double -> Double.class",
-            Double.class, ClassUtils.primitiveToWrapper(Double.TYPE));
-        assertEquals("float -> Float.class",
-            Float.class, ClassUtils.primitiveToWrapper(Float.TYPE));
-
-        // test a few other classes
-        assertEquals("String.class -> String.class",
-            String.class, ClassUtils.primitiveToWrapper(String.class));
-        assertEquals("ClassUtils.class -> ClassUtils.class",
-            org.apache.commons.lang3.ClassUtils.class,
-            ClassUtils.primitiveToWrapper(org.apache.commons.lang3.ClassUtils.class));
-        assertEquals("Void.TYPE -> Void.TYPE",
-            Void.TYPE, ClassUtils.primitiveToWrapper(Void.TYPE));
-
-        // test null
-        assertNull("null -> null",
-            ClassUtils.primitiveToWrapper(null));
-    }
-
-    @Test
-    public void testPrimitivesToWrappers() {
-        // test null
-//        assertNull("null -> null", ClassUtils.primitivesToWrappers(null)); // generates warning
-        assertNull("null -> null", ClassUtils.primitivesToWrappers((Class<?>[]) null)); // equivalent cast to avoid warning
-        // Other possible casts for null
-        assertTrue("empty -> empty", Arrays.equals(ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.primitivesToWrappers()));
-        final Class<?>[] castNull = ClassUtils.primitivesToWrappers((Class<?>)null); // == new Class<?>[]{null}
-        assertTrue("(Class<?>)null -> [null]", Arrays.equals(new Class<?>[]{null}, castNull));
-        // test empty array is returned unchanged
-        assertArrayEquals("empty -> empty",
-                ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.primitivesToWrappers(ArrayUtils.EMPTY_CLASS_ARRAY));
-
-        // test an array of various classes
-        final Class<?>[] primitives = new Class[] {
-                Boolean.TYPE, Byte.TYPE, Character.TYPE, Short.TYPE,
-                Integer.TYPE, Long.TYPE, Double.TYPE, Float.TYPE,
-                String.class, ClassUtils.class
-        };
-        final Class<?>[] wrappers= ClassUtils.primitivesToWrappers(primitives);
-
-        for (int i=0; i < primitives.length; i++) {
-            // test each returned wrapper
-            final Class<?> primitive = primitives[i];
-            final Class<?> expectedWrapper = ClassUtils.primitiveToWrapper(primitive);
-
-            assertEquals(primitive + " -> " + expectedWrapper, expectedWrapper, wrappers[i]);
-        }
-
-        // test an array of no primitive classes
-        final Class<?>[] noPrimitives = new Class[] {
-                String.class, ClassUtils.class, Void.TYPE
-        };
-        // This used to return the exact same array, but no longer does.
-        assertNotSame("unmodified", noPrimitives, ClassUtils.primitivesToWrappers(noPrimitives));
-    }
-
-    @Test
-    public void testWrapperToPrimitive() {
-        // an array with classes to convert
-        final Class<?>[] primitives = {
-                Boolean.TYPE, Byte.TYPE, Character.TYPE, Short.TYPE,
-                Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE
-        };
-        for (final Class<?> primitive : primitives) {
-            final Class<?> wrapperCls = ClassUtils.primitiveToWrapper(primitive);
-            assertFalse("Still primitive", wrapperCls.isPrimitive());
-            assertEquals(wrapperCls + " -> " + primitive, primitive,
-                    ClassUtils.wrapperToPrimitive(wrapperCls));
-        }
-    }
-
-    @Test
-    public void testWrapperToPrimitiveNoWrapper() {
-        assertNull("Wrong result for non wrapper class", ClassUtils.wrapperToPrimitive(String.class));
-    }
-
-    @Test
-    public void testWrapperToPrimitiveNull() {
-        assertNull("Wrong result for null class", ClassUtils.wrapperToPrimitive(null));
-    }
-
-    @Test
-    public void testWrappersToPrimitives() {
-        // an array with classes to test
-        final Class<?>[] classes = {
-                Boolean.class, Byte.class, Character.class, Short.class,
-                Integer.class, Long.class, Float.class, Double.class,
-                String.class, ClassUtils.class, null
-        };
-
-        final Class<?>[] primitives = ClassUtils.wrappersToPrimitives(classes);
-        // now test the result
-        assertEquals("Wrong length of result array", classes.length, primitives.length);
-        for (int i = 0; i < classes.length; i++) {
-            final Class<?> expectedPrimitive = ClassUtils.wrapperToPrimitive(classes[i]);
-            assertEquals(classes[i] + " -> " + expectedPrimitive, expectedPrimitive,
-                    primitives[i]);
-        }
-    }
-
-    @Test
-    public void testWrappersToPrimitivesNull() {
-//        assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives(null)); // generates warning
-        assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives((Class<?>[]) null)); // equivalent cast
-        // Other possible casts for null
-        assertTrue("empty -> empty", Arrays.equals(ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.wrappersToPrimitives()));
-        final Class<?>[] castNull = ClassUtils.wrappersToPrimitives((Class<?>)null); // == new Class<?>[]{null}
-        assertTrue("(Class<?>)null -> [null]", Arrays.equals(new Class<?>[]{null}, castNull));
-}
-
-    @Test
-    public void testWrappersToPrimitivesEmpty() {
-        final Class<?>[] empty = new Class[0];
-        assertArrayEquals("Wrong result for empty input", empty, ClassUtils.wrappersToPrimitives(empty));
-    }
-
-    @Test
-    public void testGetClassClassNotFound() throws Exception {
-        assertGetClassThrowsClassNotFound( "bool" );
-        assertGetClassThrowsClassNotFound( "bool[]" );
-        assertGetClassThrowsClassNotFound( "integer[]" );
-    }
-
-    @Test
-    public void testGetClassInvalidArguments() throws Exception {
-        assertGetClassThrowsNullPointerException( null );
-        assertGetClassThrowsClassNotFound( "[][][]" );
-        assertGetClassThrowsClassNotFound( "[[]" );
-        assertGetClassThrowsClassNotFound( "[" );
-        assertGetClassThrowsClassNotFound( "java.lang.String][" );
-        assertGetClassThrowsClassNotFound( ".hello.world" );
-        assertGetClassThrowsClassNotFound( "hello..world" );
-    }
-
-    @Test
-    public void testWithInterleavingWhitespace() throws ClassNotFoundException {
-        assertEquals( int[].class, ClassUtils.getClass( " int [ ] " ) );
-        assertEquals( long[].class, ClassUtils.getClass( "\rlong\t[\n]\r" ) );
-        assertEquals( short[].class, ClassUtils.getClass( "\tshort                \t\t[]" ) );
-        assertEquals( byte[].class, ClassUtils.getClass( "byte[\t\t\n\r]   " ) );
-    }
-
-    @Test
-    public void testGetInnerClass() throws ClassNotFoundException {
-        assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest.Inner.DeeplyNested" ) );
-        assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest.Inner$DeeplyNested" ) );
-        assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest$Inner$DeeplyNested" ) );
-        assertEquals( Inner.DeeplyNested.class, ClassUtils.getClass( "org.apache.commons.lang3.ClassUtilsTest$Inner.DeeplyNested" ) );
-    }
-
-    @Test
-    public void testGetClassByNormalNameArrays() throws ClassNotFoundException {
-        assertEquals( int[].class, ClassUtils.getClass( "int[]" ) );
-        assertEquals( long[].class, ClassUtils.getClass( "long[]" ) );
-        assertEquals( short[].class, ClassUtils.getClass( "short[]" ) );
-        assertEquals( byte[].class, ClassUtils.getClass( "byte[]" ) );
-        assertEquals( char[].class, ClassUtils.getClass( "char[]" ) );
-        assertEquals( float[].class, ClassUtils.getClass( "float[]" ) );
-        assertEquals( double[].class, ClassUtils.getClass( "double[]" ) );
-        assertEquals( boolean[].class, ClassUtils.getClass( "boolean[]" ) );
-        assertEquals( String[].class, ClassUtils.getClass( "java.lang.String[]" ) );
-        assertEquals( java.util.Map.Entry[].class, ClassUtils.getClass( "java.util.Map.Entry[]" ) );
-        assertEquals( java.util.Map.Entry[].class, ClassUtils.getClass( "java.util.Map$Entry[]" ) );
-        assertEquals( java.util.Map.Entry[].class, ClassUtils.getClass( "[Ljava.util.Map.Entry;" ) );
-        assertEquals( java.util.Map.Entry[].class, ClassUtils.getClass( "[Ljava.util.Map$Entry;" ) );
-    }
-
-    @Test
-    public void testGetClassByNormalNameArrays2D() throws ClassNotFoundException {
-        assertEquals( int[][].class, ClassUtils.getClass( "int[][]" ) );
-        assertEquals( long[][].class, ClassUtils.getClass( "long[][]" ) );
-        assertEquals( short[][].class, ClassUtils.getClass( "short[][]" ) );
-        assertEquals( byte[][].class, ClassUtils.getClass( "byte[][]" ) );
-        assertEquals( char[][].class, ClassUtils.getClass( "char[][]" ) );
-        assertEquals( float[][].class, ClassUtils.getClass( "float[][]" ) );
-        assertEquals( double[][].class, ClassUtils.getClass( "double[][]" ) );
-        assertEquals( boolean[][].class, ClassUtils.getClass( "boolean[][]" ) );
-        assertEquals( String[][].class, ClassUtils.getClass( "java.lang.String[][]" ) );
-    }
-
-    @Test
-    public void testGetClassWithArrayClasses2D() throws Exception {
-        assertGetClassReturnsClass( String[][].class );
-        assertGetClassReturnsClass( int[][].class );
-        assertGetClassReturnsClass( long[][].class );
-        assertGetClassReturnsClass( short[][].class );
-        assertGetClassReturnsClass( byte[][].class );
-        assertGetClassReturnsClass( char[][].class );
-        assertGetClassReturnsClass( float[][].class );
-        assertGetClassReturnsClass( double[][].class );
-        assertGetClassReturnsClass( boolean[][].class );
-    }
-
-    @Test
-    public void testGetClassWithArrayClasses() throws Exception {
-        assertGetClassReturnsClass( String[].class );
-        assertGetClassReturnsClass( int[].class );
-        assertGetClassReturnsClass( long[].class );
-        assertGetClassReturnsClass( short[].class );
-        assertGetClassReturnsClass( byte[].class );
-        assertGetClassReturnsClass( char[].class );
-        assertGetClassReturnsClass( float[].class );
-        assertGetClassReturnsClass( double[].class );
-        assertGetClassReturnsClass( boolean[].class );
+        assertFalse("this.getClass()", ClassUtils.isPrimitiveWrapper(this.getClass()));
     }
 
     @Test
-    public void testGetClassRawPrimitives() throws ClassNotFoundException {
-        assertEquals( int.class, ClassUtils.getClass( "int" ) );
-        assertEquals( long.class, ClassUtils.getClass( "long" ) );
-        assertEquals( short.class, ClassUtils.getClass( "short" ) );
-        assertEquals( byte.class, ClassUtils.getClass( "byte" ) );
-        assertEquals( char.class, ClassUtils.getClass( "char" ) );
-        assertEquals( float.class, ClassUtils.getClass( "float" ) );
-        assertEquals( double.class, ClassUtils.getClass( "double" ) );
-        assertEquals( boolean.class, ClassUtils.getClass( "boolean" ) );
-        assertEquals( void.class, ClassUtils.getClass( "void" ) );
-    }
+    public void testPrimitivesToWrappers() {
+        // test null
+//        assertNull("null -> null", ClassUtils.primitivesToWrappers(null)); // generates warning
+        assertNull("null -> null", ClassUtils.primitivesToWrappers((Class<?>[]) null)); // equivalent cast to avoid warning
+        // Other possible casts for null
+        assertTrue("empty -> empty", Arrays.equals(ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.primitivesToWrappers()));
+        final Class<?>[] castNull = ClassUtils.primitivesToWrappers((Class<?>)null); // == new Class<?>[]{null}
+        assertTrue("(Class<?>)null -> [null]", Arrays.equals(new Class<?>[]{null}, castNull));
+        // test empty array is returned unchanged
+        assertArrayEquals("empty -> empty",
+                ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.primitivesToWrappers(ArrayUtils.EMPTY_CLASS_ARRAY));
 
-    private void assertGetClassReturnsClass( final Class<?> c ) throws Exception {
-        assertEquals( c, ClassUtils.getClass( c.getName() ) );
-    }
+        // test an array of various classes
+        final Class<?>[] primitives = new Class[] {
+                Boolean.TYPE, Byte.TYPE, Character.TYPE, Short.TYPE,
+                Integer.TYPE, Long.TYPE, Double.TYPE, Float.TYPE,
+                String.class, ClassUtils.class
+        };
+        final Class<?>[] wrappers= ClassUtils.primitivesToWrappers(primitives);
 
-    private void assertGetClassThrowsException( final String className, final Class<?> exceptionType ) throws Exception {
-        try {
-            ClassUtils.getClass( className );
-            fail( "ClassUtils.getClass() should fail with an exception of type " + exceptionType.getName() + " when given class name \"" + className + "\"." );
-        } catch( final Exception e ) {
-            assertTrue( exceptionType.isAssignableFrom( e.getClass() ) );
+        for (int i=0; i < primitives.length; i++) {
+            // test each returned wrapper
+            final Class<?> primitive = primitives[i];
+            final Class<?> expectedWrapper = ClassUtils.primitiveToWrapper(primitive);
+
+            assertEquals(primitive + " -> " + expectedWrapper, expectedWrapper, wrappers[i]);
         }
-    }
 
-    private void assertGetClassThrowsNullPointerException( final String className ) throws Exception {
-        assertGetClassThrowsException( className, NullPointerException.class );
+        // test an array of no primitive classes
+        final Class<?>[] noPrimitives = new Class[] {
+                String.class, ClassUtils.class, Void.TYPE
+        };
+        // This used to return the exact same array, but no longer does.
+        assertNotSame("unmodified", noPrimitives, ClassUtils.primitivesToWrappers(noPrimitives));
     }
 
-    private void assertGetClassThrowsClassNotFound( final String className ) throws Exception {
-        assertGetClassThrowsException( className, ClassNotFoundException.class );
+    @Test
+    public void testPrimitiveToWrapper() {
+
+        // test primitive classes
+        assertEquals("boolean -> Boolean.class",
+            Boolean.class, ClassUtils.primitiveToWrapper(Boolean.TYPE));
+        assertEquals("byte -> Byte.class",
+            Byte.class, ClassUtils.primitiveToWrapper(Byte.TYPE));
+        assertEquals("char -> Character.class",
+            Character.class, ClassUtils.primitiveToWrapper(Character.TYPE));
+        assertEquals("short -> Short.class",
+            Short.class, ClassUtils.primitiveToWrapper(Short.TYPE));
+        assertEquals("int -> Integer.class",
+            Integer.class, ClassUtils.primitiveToWrapper(Integer.TYPE));
+        assertEquals("long -> Long.class",
+            Long.class, ClassUtils.primitiveToWrapper(Long.TYPE));
+        assertEquals("double -> Double.class",
+            Double.class, ClassUtils.primitiveToWrapper(Double.TYPE));
+        assertEquals("float -> Float.class",
+            Float.class, ClassUtils.primitiveToWrapper(Float.TYPE));
+
+        // test a few other classes
+        assertEquals("String.class -> String.class",
+            String.class, ClassUtils.primitiveToWrapper(String.class));
+        assertEquals("ClassUtils.class -> ClassUtils.class",
+            org.apache.commons.lang3.ClassUtils.class,
+            ClassUtils.primitiveToWrapper(org.apache.commons.lang3.ClassUtils.class));
+        assertEquals("Void.TYPE -> Void.TYPE",
+            Void.TYPE, ClassUtils.primitiveToWrapper(Void.TYPE));
+
+        // test null
+        assertNull("null -> null",
+            ClassUtils.primitiveToWrapper(null));
     }
 
     // Show the Java bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957
@@ -1105,24 +1178,6 @@ public class ClassUtilsTest  {
     }
 
     @Test
-    public void testGetPublicMethod() throws Exception {
-        // Tests with Collections$UnmodifiableSet
-        final Set<?> set = Collections.unmodifiableSet(new HashSet<>());
-        final Method isEmptyMethod = ClassUtils.getPublicMethod(set.getClass(), "isEmpty");
-            assertTrue(Modifier.isPublic(isEmptyMethod.getDeclaringClass().getModifiers()));
-
-        try {
-            isEmptyMethod.invoke(set);
-        } catch(final java.lang.IllegalAccessException iae) {
-            fail("Should not have thrown IllegalAccessException");
-        }
-
-        // Tests with a public Class
-        final Method toStringMethod = ClassUtils.getPublicMethod(Object.class, "toString");
-            assertEquals(Object.class.getMethod("toString", new Class[0]), toStringMethod);
-    }
-
-    @Test
     public void testToClass_object() {
 //        assertNull(ClassUtils.toClass(null)); // generates warning
         assertNull(ClassUtils.toClass((Object[]) null)); // equivalent explicit cast
@@ -1142,125 +1197,70 @@ public class ClassUtilsTest  {
     }
 
     @Test
-    public void test_getShortCanonicalName_Object() {
-        assertEquals("<null>", ClassUtils.getShortCanonicalName(null, "<null>"));
-        assertEquals("ClassUtils", ClassUtils.getShortCanonicalName(new ClassUtils(), "<null>"));
-        assertEquals("ClassUtils[]", ClassUtils.getShortCanonicalName(new ClassUtils[0], "<null>"));
-        assertEquals("ClassUtils[][]", ClassUtils.getShortCanonicalName(new ClassUtils[0][0], "<null>"));
-        assertEquals("int[]", ClassUtils.getShortCanonicalName(new int[0], "<null>"));
-        assertEquals("int[][]", ClassUtils.getShortCanonicalName(new int[0][0], "<null>"));
-
-        // Inner types
-        class Named {}
-        assertEquals("ClassUtilsTest.6", ClassUtils.getShortCanonicalName(new Object(){}, "<null>"));
-        assertEquals("ClassUtilsTest.5Named", ClassUtils.getShortCanonicalName(new Named(), "<null>"));
-        assertEquals("ClassUtilsTest.Inner", ClassUtils.getShortCanonicalName(new Inner(), "<null>"));
-    }
-
-    @Test
-    public void test_getShortCanonicalName_Class() {
-        assertEquals("ClassUtils", ClassUtils.getShortCanonicalName(ClassUtils.class));
-        assertEquals("ClassUtils[]", ClassUtils.getShortCanonicalName(ClassUtils[].class));
-        assertEquals("ClassUtils[][]", ClassUtils.getShortCanonicalName(ClassUtils[][].class));
-        assertEquals("int[]", ClassUtils.getShortCanonicalName(int[].class));
-        assertEquals("int[][]", ClassUtils.getShortCanonicalName(int[][].class));
-
-        // Inner types
-        class Named {}
-        assertEquals("ClassUtilsTest.7", ClassUtils.getShortCanonicalName(new Object(){}.getClass()));
-        assertEquals("ClassUtilsTes

<TRUNCATED>

Mime
View raw message