### Question:
Urls { public static String trimLeadingAndTrailingSlashJoin( String... parts ) { StringBuilder s = new StringBuilder(); if( parts != null ) { String p = ""; String n; for (String part : parts) { n = trimLeadingAndTrailingSlash(part); if (!n.isEmpty()) { if (!p.isEmpty()) { s.append('/'); } s.append(n); p = n; } } } return s.toString(); }  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 testTrimLeadingAndTrailingSlashJoin() throws Exception { assertEquals( "", Urls.trimLeadingAndTrailingSlashJoin( null ) ); assertEquals( "", Urls.trimLeadingAndTrailingSlashJoin( "" ) ); assertEquals( "", Urls.trimLeadingAndTrailingSlashJoin( "", "" ) ); assertEquals( "x", Urls.trimLeadingAndTrailingSlashJoin( "x" ) ); assertEquals( "x", Urls.trimLeadingAndTrailingSlashJoin( "x", "" ) ); assertEquals( "x", Urls.trimLeadingAndTrailingSlashJoin( "", "x", "" ) ); assertEquals( "x/x", Urls.trimLeadingAndTrailingSlashJoin( "", "x", "", "", "x" ) ); assertEquals( "x/x", Urls.trimLeadingAndTrailingSlashJoin( null, "x", null, null, "x" ) ); assertEquals( "x/y/z", Urls.trimLeadingAndTrailingSlashJoin( "x", "y", "z" ) ); }