### Question:
Paths { public static String getParentOf(String path) { int i = path.lastIndexOf(DELIM); if (i == -1) return ""; if (i == 0) i = 1; return path.substring(0, i); }  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 reparented(String path, String newParentPath); static String relativeIfUnder(String path, String root); static Iterable<String> split(String path); static boolean isParent(String parent, String path); static boolean isParentOrChild(String p1, String p2); static boolean equals(String p1, String p2); static void setCaseSensitive(boolean b); static boolean isCaseSensitive(); static void useSystemCaseSensitivity(); static final char DELIM; }### Answer:
@Test public void testParent() { assertEquals("dir1/dir2", Paths.getParentOf("dir1/dir2/file")); assertEquals("", Paths.getParentOf("file")); assertEquals("c:", Paths.getParentOf("c:/file")); assertEquals("/", Paths.getParentOf("/file")); assertEquals("/dir", Paths.getParentOf("/dir/file")); }