### Question:
DNS { public static String getDefaultHost(String strInterface, String nameserver) throws UnknownHostException { if ("default".equals(strInterface)) { return cachedHostname; } if ("default".equals(nameserver)) { return getDefaultHost(strInterface); } String[] hosts = getHosts(strInterface, nameserver); return hosts[0]; }  static String reverseDns(InetAddress hostIp, String ns); static String[] getIPs(String strInterface); static String[] getIPs(String strInterface,
      boolean returnSubinterfaces); static String getDefaultIP(String strInterface); static String[] getHosts(String strInterface, String nameserver); static String[] getHosts(String strInterface); static String getDefaultHost(String strInterface, String nameserver); static String getDefaultHost(String strInterface);  }### Answer:
@Test public void testGetLocalHost() throws Exception { String hostname = DNS.getDefaultHost(DEFAULT); assertNotNull(hostname); }
@Test public void testGetLocalHostIsFast() throws Exception { String hostname1 = DNS.getDefaultHost(DEFAULT); assertNotNull(hostname1); String hostname2 = DNS.getDefaultHost(DEFAULT); long t1 = Time.now(); String hostname3 = DNS.getDefaultHost(DEFAULT); long t2 = Time.now(); assertEquals(hostname3, hostname2); assertEquals(hostname2, hostname1); long interval = t2 - t1; assertTrue( "Took too long to determine local host - caching is not working", interval < 20000); }