### Question:
UrlUtils { public static String getHostIPAddress(String fqdn) throws UnknownHostException { return InetAddress.getByName(fqdn).getHostAddress(); }  static String trimSlashes(String string); static String getEncodedUrl(String url); static String removeFirstAndLastSlash(String uri); static String addFirstSlash(String uri); static String removeLastSlash(String uri); static String getHostIPAddress(String fqdn); static String getIpAddressFromUrl(String urlString);  }### Answer:
@Test public void testGetHostIPAddress_DoesNotExist() throws UnknownHostException { thrown.expect(UnknownHostException.class); String fqdn = "Does-Not-Exist"; String ipAddress = UrlUtils.getHostIPAddress(fqdn); assertNull(ipAddress); }
@Test public void testGetHostIPAddress_Ok() throws UnknownHostException { String fqdn = "www.google.com"; String ipAddress = UrlUtils.getHostIPAddress(fqdn); assertNotNull(ipAddress); }
@Test public void testGetIPAddressFromUrl_BAD_PROTOCOL() throws UnknownHostException { thrown.expect(UnknownHostException.class); String fqdn = "httpp: String ipAddress = UrlUtils.getHostIPAddress(fqdn); assertNull(ipAddress); }
@Test public void testGetIPAddressFromUrl_NULL_Address() throws UnknownHostException { thrown.expect(UnknownHostException.class); String fqdn = "http: String ipAddress = UrlUtils.getHostIPAddress(fqdn); assertNull(ipAddress); }
@Test public void testValidateUrl_OK() throws UnknownHostException { thrown.expect(UnknownHostException.class); String fqdn = "http: String ipAddress = UrlUtils.getHostIPAddress(fqdn); assertNull(ipAddress); }