Ip implements Serializable, Comparable<Ip> { public String addr() { return toString(); } Ip(long ip);  Ip(String ip); protected  Ip(); String addr(); long longValue(); @Override String toString(); boolean isIp4(); boolean isIp6(); @Override int hashCode(); @Override boolean equals(Object obj); boolean isSameAddressAs(Object obj); @Override int compareTo(Ip that);  }
@Test public void testUltimate() { Ip max = new Ip(2L * Integer.MAX_VALUE +1 ); assertEquals("Maximal address not created", "255.255.255.255", max.addr()); }
@Test public void testTurningOfTheCentury() { Ip eve = new Ip(Integer.MAX_VALUE); assertEquals("Minimal address not created", "127.255.255.255", eve.addr()); Ip dawn = new Ip(Integer.MAX_VALUE + 1L); assertEquals("Minimal address not created", "128.0.0.0", dawn.addr()); }
@Test public void testStart() { Ip min = new Ip(0); assertEquals("Minimal address not created", "0.0.0.0", min.addr()); }