### Question:
OtherUtil { public static final String getHostName() { try { String hostName = InetAddress.getLocalHost().getHostAddress(); if ( hostName.equals(Constant.LOCALHOST) ) { Enumeration<NetworkInterface> netEnum = NetworkInterface.getNetworkInterfaces(); LOOP: while ( netEnum.hasMoreElements() ) { NetworkInterface inet = netEnum.nextElement(); Enumeration<InetAddress> net = inet.getInetAddresses(); while ( net.hasMoreElements() ) { hostName = net.nextElement().getHostAddress(); if ( hostName.startsWith("192") ) { break LOOP; } else if ( hostName.startsWith("10") ) { break LOOP; } } } } return hostName.trim(); } catch (Exception e) { e.printStackTrace(); } return Constant.LOCALHOST; }  static final String getHostName();  }### Answer:
@Test public void test() throws Exception { String hostName = OtherUtil.getHostName(); System.out.println("hostname: " + hostName); assertTrue(!"127.0.0.1".equals(hostName)); }