URLUtils { static public String removeTrailingSlashes(String s) { if (s == null || s.length() < 2) { return s; } if (s.trim().charAt(s.length() - 1) == '/') { return removeTrailingSlashes(s.substring(0, s.length() - 1)); } else { return s.trim(); } }  static String removeTrailingSlashes(String s); static String decodeQueryString(String qs); static String getParentPath(String path); static String getPrefixUrl(HttpServerExchange exchange); static String getQueryStringRemovingParams(HttpServerExchange exchange, String... paramsToRemove); static String getIdString(BsonValue id);  }
@Test public void testRemoveTrailingSlashes() { String s = "/ciao/this/has/trailings String expResult = "/ciao/this/has/trailings"; String result = URLUtils.removeTrailingSlashes(s); assertEquals(expResult, result); }