PathUtils { public static String addLeadingSlash(String path) { if (path == null) { return null; } if (!path.isEmpty() && path.charAt(0) == '/') { return path; } return "/" + path; }  static String join(String... paths); static String normalize(String path); static boolean isAbsolute(String path); static String removeLeadingSlash(String path); static String addLeadingSlash(String path); static String addTrailingSlash(String path);  }
@Test public void testAddLeadingSlash() { assertEquals("/abc", addLeadingSlash("abc")); assertEquals("/abc/abc", addLeadingSlash("/abc/abc")); assertEquals("/abc/abc/", addLeadingSlash("abc/abc/")); assertEquals("/", addLeadingSlash("")); }