URLUtil { public static String removeTrailingSlash(String url) { int i = url.length() - 1; while (i >= 0 && url.charAt(i) == '/') { i--; } return url.substring(0, i + 1); }  static String removeTrailingSlash(String url);  }
@Test public void testRemoveTrailingSlash() { String url = URLUtil.removeTrailingSlash("http: Assert.assertEquals("http: url = URLUtil.removeTrailingSlash("http: Assert.assertEquals("http: url = URLUtil.removeTrailingSlash("http: Assert.assertEquals("http: url = URLUtil.removeTrailingSlash(""); Assert.assertEquals("", url); }