LocalNetwork { @Override public String toString() { return getClass().getSimpleName() + "(" + interfaceIp.toString() + "\\" + networkPrefixLength + ")"; } LocalNetwork(InetAddress interfaceIp, int networkPrefixLength); InetAddress getInterfaceIp(); InetAddress getNetmask(); int getNetworkPrefixLength(); InetAddress getBroadcast(); @Override String toString();  }
@Test public void testLocalNetworkToString() throws Exception { InetAddress test = InetAddress.getByAddress(testAdress); LocalNetwork localNetwork = new LocalNetwork(test, 0); Assert.assertTrue(localNetwork.toString().indexOf("192.168.127.127") >= 0); }