PathUtils { public static String extractName(String nameWithPath) { int index = nameWithPath.lastIndexOf(UNIX_PATH_SEPARATOR); return index > -1 ? nameWithPath.substring(index + 1) : nameWithPath; } private  PathUtils(); static String unixPath(@NotNull String first, String... more); static String unixPath(@NotNull Path path); @NotNull static String unixPathEndingWithSeparator(@NotNull String first, String... more); @NotNull static String unixPathEndingWithSeparator(@NotNull Path path); static String extractName(String nameWithPath); static String extractPath(String nameWithPath); static String extractNameFromUniqueEntityName(String uniqueName);  }
@Test void testExtractName() { assertEquals("test", PathUtils.extractName("test")); assertEquals("test", PathUtils.extractName("path/test")); assertEquals("test", PathUtils.extractName("/path/subpath/test")); }