@Test public void testNonDefaultPackageClassNameParsing() { assertThat(Compilations.getPublicClassName("package a.b; public class X {}")) .isEqualTo("a.b.X"); assertThat(Compilations.getPublicClassName(" package a.b; public class X {}")) .isEqualTo("a.b.X"); assertThat(Compilations.getPublicClassName("\n package a.b; \n public class X {}")) .isEqualTo("a.b.X"); }
@VisibleForTesting static String getPublicClassName(String source) { Matcher matcher = CLASS_NAME_PATTERN.matcher(source); if (matcher.find()) { return getPackagePrefix(source) + matcher.group(1); } else { return ""; } }
Compilations { @VisibleForTesting static String getPublicClassName(String source) { Matcher matcher = CLASS_NAME_PATTERN.matcher(source); if (matcher.find()) { return getPackagePrefix(source) + matcher.group(1); } else { return ""; } } }
Compilations { @VisibleForTesting static String getPublicClassName(String source) { Matcher matcher = CLASS_NAME_PATTERN.matcher(source); if (matcher.find()) { return getPackagePrefix(source) + matcher.group(1); } else { return ""; } } private  Compilations(); }
Compilations { @VisibleForTesting static String getPublicClassName(String source) { Matcher matcher = CLASS_NAME_PATTERN.matcher(source); if (matcher.find()) { return getPackagePrefix(source) + matcher.group(1); } else { return ""; } } private  Compilations(); static Class<?> compile(String source); }
Compilations { @VisibleForTesting static String getPublicClassName(String source) { Matcher matcher = CLASS_NAME_PATTERN.matcher(source); if (matcher.find()) { return getPackagePrefix(source) + matcher.group(1); } else { return ""; } } private  Compilations(); static Class<?> compile(String source);  }