PathUtils { public static String noStartingSlash(String path) { Objects.requireNonNull(path, "path must not be null"); return hasStartingSlash(path) ? path.substring(1) : path; }  static String noStartingSlash(String path); static boolean hasStartingSlash(String path); static String noPrefix(String path, String prefix); static String ensureStartingSlash(String path); static String ensureEndingSlash(String path); static String ensureNotEndingSlash(String path); static String normalizePath(String path);  }
@Test public void noStartingSlash() { assertThat(PathUtils.noStartingSlash("foo"), is("foo")); assertThat(PathUtils.noStartingSlash("/foo"), is("foo")); assertThat(PathUtils.noStartingSlash("/foo/"), is("foo/")); assertThat(PathUtils.noStartingSlash("/"), is("")); assertThat(PathUtils.noStartingSlash(""), is("")); }