Paths { public static String renamed(String path, String newName) { String parent = getParentOf(path); return parent == null ? newName : appended(parent, newName); }  static String getNameOf(String path); static String getParentOf(String path); static String appended(String path, String child); static String renamed(String path, String newName); static String withoutRootIfUnder(String path, String root); static boolean isParent(String parent, String path); static boolean equals(String p1, String p2); static void setCaseSensitive(boolean b); static boolean isCaseSensitive(); static void useSystemCaseSensitivity();  }
@Test public void testRenaming() { assertEquals("dir/file2", Paths.renamed("dir/file1", "file2")); assertEquals("file2", Paths.renamed("file1", "file2")); }