### Question:
UrlParts { public static String ensureEndsWithSlash(String uri) { if (uri == null) { return "/"; } if (!uri.endsWith("/")) { return String.format("%s/", uri); } return uri; }  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 testEnsureEndsWithSlash() { String blaSample = UrlParts.ensureEndsWithSlash("/bla"); String nullSample = UrlParts.ensureEndsWithSlash(null); String withEndSample = UrlParts.ensureEndsWithSlash("/bla/"); assertThat(blaSample, equalTo("/bla/")); assertThat(nullSample, equalTo("/")); assertThat(withEndSample, equalTo("/bla/")); }