AsmUtil { public static String toClassName(String className, boolean collapseInnerClasses) { if (className == null) { return null; } if (collapseInnerClasses && className.indexOf('$') >= 0) { return toClassName(className.substring(0, className.indexOf('$'))); } return toClassName(className); } private  AsmUtil(); static List<String> getParameterTypeNames(String desc, boolean collapseInnerClasses); static String toClassName(String className, boolean collapseInnerClasses);  }
@Test public void testToClassName() { assertThat(AsmUtil.toClassName("java/util/List", true), is("java.util.List")); assertThat(AsmUtil.toClassName("de/qaware/qav/A$1", true), is("de.qaware.qav.A")); assertThat(AsmUtil.toClassName("de/qaware/qav/A$1", false), is("de.qaware.qav.A$1")); assertThat(AsmUtil.toClassName("Lde/qaware/qav/A;", true), is("de.qaware.qav.A")); assertThat(AsmUtil.toClassName("[Lde/qaware/qav/A;", true), is("de.qaware.qav.A")); assertThat(AsmUtil.toClassName("[[Lde/qaware/qav/A;", true), is("de.qaware.qav.A")); assertThat(AsmUtil.toClassName("byte[]", true), is("byte")); assertThat(AsmUtil.toClassName(null, true), nullValue()); }
@Test public void testApplyTwiceDoesNotMatter() { assertThat(AsmUtil.toClassName("java.util.List", true), is("java.util.List")); assertThat(AsmUtil.toClassName("java.util.List$Entry", true), is("java.util.List")); assertThat(AsmUtil.toClassName("java.util.List$Entry", false), is("java.util.List$Entry")); }