Convert { public static String enclosingClassName(String shortName) { String normalizedShortName = normalizeShortName(shortName); int lastDollar = normalizedShortName.lastIndexOf('$'); return lastDollar < 0 ? "" : normalizedShortName.substring(0, lastDollar); } private  Convert(); static String packagePart(String fullName); static String shortName(String fullName); static String flatName(String bytecodeName); static String bytecodeName(String fullName); static String enclosingClassName(String shortName); static String innerClassName(String enclosingClassName, String shortName); static String fullName(String packagePart, String className);  }
@Test void enclosingClassName() throws Exception { assertThat(Convert.enclosingClassName("MyClass")).isEmpty(); assertThat(Convert.enclosingClassName("MyClass$InnerClass")).isEqualTo("MyClass"); assertThat(Convert.enclosingClassName("MyClass$$InnerClass$class")).isEqualTo("MyClass$"); assertThat(Convert.enclosingClassName("MyClass$$InnerClass$")).isEqualTo("MyClass$"); }