PathUtil { public static String getName(String path) { validatePath(path); if (path.equals(StringPool.SLASH)) { return StringPool.SLASH; } int pos = path.lastIndexOf(StringPool.SLASH); 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 testGetName() { Assert.assertEquals("name.ext", PathUtil.getName("/name.ext")); }