### Question:
Urls { public static Optional<String> subdomain(Uri URI) { String host = URI.getHost(); int dotCount = 0; if (host == null) { return Optional.empty(); } for (int i = 0; i < host.length(); i++) { if (host.charAt(i) == '.') { ++dotCount; } } boolean hasSubDomain = dotCount > 1; if (hasSubDomain) { String hostWithoutTold = host.substring(0, host.lastIndexOf('.')); String subdomain = hostWithoutTold.substring(0, hostWithoutTold.lastIndexOf('.')); return Optional.of(subdomain); } else { return Optional.empty(); } }  static String parseDomainName(String url); static String parseFileNameWithExtension(String url); static Optional<String> subdomain(Uri URI);  }### Answer:
@Test public void subdomain() throws Exception { assertEquals("v", Urls.subdomain(Uri.parse("https: assertEquals("i", Urls.subdomain(Uri.parse("https: assertEquals(Optional.empty(), Urls.subdomain(Uri.parse("https: assertEquals("a.b.c", Urls.subdomain(Uri.parse("https: }