### Question:
Urls { public static String trimLeadingAndTrailingSlash( String s ) { if( s == null ) { return ""; } else { int b = 0; int e = s.length(); while( b < e && s.charAt( b ) == '/' ) { b++; } while( e > b && s.charAt( e-1 ) == '/' ) { e--; } return s.substring( b, e ); } }  static String ensureLeadingSlash( String s ); static String stripLeadingSlash( String s ); static String concatUrl( String prefix, String suffix ); static boolean isIp(String domain); static int dotOccurrences(String domain); static String getDomainName(String url, String domainSuffix); static String encode( String str ); static String decode( String str ); static String trimLeadingAndTrailingSlash( String s ); static String trimLeadingAndTrailingSlashJoin( String... parts );  }### Answer:
@Test public void testTrimLeadingAndTrailingSlash() { assertEquals( "", Urls.trimLeadingAndTrailingSlash( null ) ); assertEquals( "", Urls.trimLeadingAndTrailingSlash( "" ) ); assertEquals( "", Urls.trimLeadingAndTrailingSlash( "/" ) ); assertEquals( "", Urls.trimLeadingAndTrailingSlash( " assertEquals( "x", Urls.trimLeadingAndTrailingSlash( "x" ) ); assertEquals( "x/x", Urls.trimLeadingAndTrailingSlash( "x/x" ) ); assertEquals( "x", Urls.trimLeadingAndTrailingSlash( "/x/" ) ); assertEquals( "x/x", Urls.trimLeadingAndTrailingSlash( "x/x" ) ); }