### Question:
HostnameBuilder { public String buildHostname() { try { return InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { return "localhost"; } }  String buildHostname();  }### Answer:
@Test public void resolved_hostname_is_not_empty_or_null() { String hostname = builderToTest.buildHostname(); assertNotNull(hostname); assertFalse(hostname.isEmpty()); }
@Test public void resolved_hostname_is_not_localhost() { String hostname = builderToTest.buildHostname(); assertFalse(hostname.equals("localhost")); assertTrue(hostname.indexOf("localhost")==-1); }