### Question:
UrlParts { public static String removeEndsWithSlash(String path) { String value = Nulls.notNull(path); if (value.endsWith("/")) { value = value.substring(0, value.length() - 1); } return value; }  static String concatPaths(Object... parts); static String ensureEndsWithSlash(String uri); static String ensureStartsWithSlash(String uri); static String ensureStartsAndEndsWithSlash(String path); static String removeEndsWithSlash(String path); static String getBaseUrl(HttpServletRequest request);  }### Answer:
@Test public void removeEndsWithSlash() { String blaSample = UrlParts.removeEndsWithSlash("/bla"); String nullSample = UrlParts.removeEndsWithSlash(null); String withEndSample = UrlParts.removeEndsWithSlash("bla/"); String withoutSample = UrlParts.removeEndsWithSlash("bla"); assertThat(blaSample, equalTo("/bla")); assertThat(nullSample, equalTo("")); assertThat(withEndSample, equalTo("bla")); assertThat(withoutSample, equalTo("bla")); }