CommonUtils { @Nonnull public static String extractClassName(@Nonnull final String canonicalJavaClassName) { final int lastDot = canonicalJavaClassName.lastIndexOf('.'); if (lastDot < 0) { return canonicalJavaClassName.trim(); } return canonicalJavaClassName.substring(lastDot + 1).trim(); } private  CommonUtils(); @Nonnull static String ensureEncodingName(@Nullable final String charsetName); @Nonnull static String extractClassName(@Nonnull final String canonicalJavaClassName); @Nonnull static String extractPackageName(@Nonnull final String fileNameWithoutExtension); @Nonnull static File scriptFileToJavaFile(@Nullable final File targetDir, @Nullable final String classPackage, @Nonnull final File scriptFile);  }
@Test public void testExtractClassName() { assertEquals("", CommonUtils.extractClassName("")); assertEquals("", CommonUtils.extractClassName("a.b.c.")); assertEquals("hello", CommonUtils.extractClassName("hello")); assertEquals("hello", CommonUtils.extractClassName("a.b.c.hello")); assertEquals("hello", CommonUtils.extractClassName(".hello")); }