PathUtil { public static String getNameWithoutExtension(String path) { String name = getName(path); int pos = name.lastIndexOf(StringPool.PERIOD); if (pos == -1) { return name; } return name.substring(0, pos); }  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 testGetNameWithoutExtensionWithExtension() { Assert.assertEquals( "name", PathUtil.getNameWithoutExtension("/name.ext")); }
@Test public void testGetNameWithoutExtensionWithMissingExtension() { Assert.assertEquals("name", PathUtil.getNameWithoutExtension("/name.")); Assert.assertEquals("name", PathUtil.getNameWithoutExtension("/name")); }