### Question:
URLUtils { public static String extractIpFromURL(String URL) { InetAddress address; try { address = InetAddress.getByName(new URL(URL).getHost()); } catch (UnknownHostException e) { throw new IllegalArgumentException(); } catch (MalformedURLException e) { throw new IllegalArgumentException(); } return address.getHostAddress(); }  static String extractIpFromURL(String URL);  }### Answer:
@Test public void test() { String URL = URLUtils.extractIpFromURL("http: String URLWithLocalhost = URLUtils.extractIpFromURL("http: assertTrue(URLWithLocalhost.equals("localhost") || URLWithLocalhost.equals("127.0.0.1")); assertEquals("127.0.0.1", URL); assertEquals("127.0.0.1", URLUtils.extractIpFromURL("http: assertEquals("127.0.0.1", URLUtils.extractIpFromURL("http: }