### Question:
Urls { public static String getDomainName(String url, String domainSuffix) throws MalformedURLException { final URL originalUrl = new URL(url); final String domain = originalUrl.getHost(); if ("*".equals(domainSuffix)) { return domain; } if (domainSuffix != null && domain.endsWith(domainSuffix)) { return (domainSuffix.startsWith(".")) ? domainSuffix : "." + domainSuffix; } if (isIp(domain)) { return null; } if (dotOccurrences(domain) < 2) { return null; } int idx = domain.indexOf('.'); if (idx == -1) { idx = 0; } return domain.substring(idx); }  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 testDomainNameCreation() throws Exception { assertEquals(".local.com", Urls.getDomainName("http: assertEquals(".local.com", Urls.getDomainName("http: Assert.assertNull(Urls.getDomainName("http: Assert.assertNull(Urls.getDomainName("http: assertEquals(".home.test.com", Urls.getDomainName("http: assertEquals(".test.com", Urls.getDomainName("http: Assert.assertEquals(".novalocal", Urls.getDomainName("http: Assert.assertEquals(".novalocal", Urls.getDomainName("http: Assert.assertNull(Urls.getDomainName("http: assertEquals(".local.com", Urls.getDomainName("https: assertEquals(".local.com", Urls.getDomainName("https: }