Ip implements Serializable, Comparable<Ip> { @Override public boolean equals(Object obj) { if (obj instanceof Ip) { return ip == ((Ip)obj).ip; } return false; } 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 testEquals() { new EqualsTester() .addEqualityGroup(new Ip("0.0.0.1"), new Ip(1L)) .addEqualityGroup(new Ip("0.0.0.0"), new Ip(0L)) .testEquals(); }