### Question:
ClassUtil { public static Class toClass(String str, ClassLoader loader) { return toClass(str, false, loader); } private  ClassUtil(); static Class toClass(String str, ClassLoader loader); static Class toClass(String str, boolean resolve,
                                ClassLoader loader); static String getClassName(Class cls); static String getClassName(String fullName); static String getPackageName(Class cls); static String getPackageName(String fullName);  }### Answer:
@Test public void testToClass() { Assert.assertEquals(this.getClass(), toClass("org.apache.openjpa.lib.util.ClassUtilTest")); Assert.assertEquals(new ClassUtilTest[0].getClass(), toClass("org.apache.openjpa.lib.util.ClassUtilTest[]")); Assert.assertEquals(Integer.class, toClass("java.lang.Integer")); Assert.assertEquals(byte.class, toClass("byte")); Assert.assertEquals(char.class, toClass("char")); Assert.assertEquals(double.class, toClass("double")); Assert.assertEquals(float.class, toClass("float")); Assert.assertEquals(int.class, toClass("int")); Assert.assertEquals(long.class, toClass("long")); Assert.assertEquals(short.class, toClass("short")); Assert.assertEquals(boolean.class, toClass("boolean")); Assert.assertEquals(void.class, toClass("void")); Assert.assertEquals(new float[0].getClass(), toClass("float[]")); Assert.assertEquals(new float[0][0].getClass(), toClass("float[][]")); Assert.assertEquals(new long[0][0][0].getClass(), toClass("long[][][]")); }
@Test(expected = IllegalArgumentException.class) public void nonExistingClass() { toClass("does.not.Exist"); }