### Question:
NetUtils { @Nonnull public static String determineHostName() throws UnknownHostException { if (!OPT_HOSTNAME.isPresent()) { final String hostName = InetAddress.getLocalHost().getHostName(); if (Strings.isNullOrEmpty(hostName)) { throw new UnknownHostException("Unable to lookup localhost, got back empty hostname"); } if (Strings.nullToEmpty(hostName).equals("0.0.0.0")) { throw new UnknownHostException("Unable to resolve correct hostname saw bad host"); } OPT_HOSTNAME = Optional.of(hostName); return OPT_HOSTNAME.get(); } else { return OPT_HOSTNAME.get(); } }  @Nonnull static String determineHostName(); @Nonnull static String determineHostName(@Nonnull final String defaultValue); @Nullable static String determineIpAddress(); static byte[] getRawAddress(final String ipv4Address);  }### Answer:
@Test public void testGetHostname() throws Exception { assertFalse(NetUtils.determineHostName("unknown").equals("unknown")); assertFalse(NetUtils.determineHostName("unknown").equals("unknown")); assertFalse(NetUtils.determineHostName("unknown").equals("unknown")); }
@Test(expected = NullPointerException.class) public void testNullException() throws Exception { NetUtils.determineHostName(null); }