PathUtil { public static String getExtension(String path) { int pos = path.lastIndexOf(StringPool.PERIOD); if (pos == -1) { return StringPool.BLANK; } return path.substring(pos + 1); }  static String buildPath(String folderPath, String name); static String getExtension(String path); static String getName(String path); static String getNameWithoutExtension(String path); static String getParentFolderPath(String path); static void validateName(String name); static void validatePath(String path);  }
@Test public void testGetExtensionWhithMissingExtension() { Assert.assertEquals(StringPool.BLANK, PathUtil.getExtension("/name.")); Assert.assertEquals(StringPool.BLANK, PathUtil.getExtension("/name")); }
@Test public void testGetExtensionWithExtension() { Assert.assertEquals("ext", PathUtil.getExtension("/name.ext")); }