Hosts { public static String getLocalHostName() throws UnknownHostException { String preffered = System.getProperty(PREFERED_ADDRESS_PROPERTY_NAME); return chooseAddress(preffered).getHostName(); } private  Hosts(); static Map<String, Set<InetAddress>> getNetworkInterfaceAddresses(boolean includeLoopback); static Set<InetAddress> getAddresses(); static String getLocalHostName(); static String getLocalIp(); static final String PREFERED_ADDRESS_PROPERTY_NAME; }
@Test public void getLocalHostName() throws Exception { assertNotNull(Hosts.getLocalHostName()); }