### Question:
Hosts { @Nonnull static Host parse(String hostname) { String ascii = validateAndConvertToAscii(hostname); Host host; if (Ip6.isIpv6(ascii)) { host = Ip6.parse(ascii); } else { if (ascii.endsWith(".")) { ascii = ascii.substring(0, ascii.length() - 1); } if (Ip4.isIpv4(ascii)) { host = Ip4.parse(ascii); } else { host = Dns.parse(ascii); } } if (host == null) { throw new IllegalArgumentException("Invalid hostname: " + hostname); } return host; }    }### Answer:
@Test public void allowTrailingDot() { assertEquals(Hosts.parse("example.com"), Hosts.parse("example.com.")); assertEquals(Hosts.parse("example"), Hosts.parse("example.")); assertEquals(Hosts.parse("1.1.1.1"), Hosts.parse("1.1.1.1.")); }
@Test public void convertToLowerCase() { assertEquals(Hosts.parse("example.com"), Hosts.parse("Example.com")); assertEquals(Hosts.parse("ökonom.de"), Hosts.parse("Ökonom.de")); assertEquals(Hosts.parse("ли.ru"), Hosts.parse("Ли.ru")); }