@Test public void testEquals() throws Exception { new EqualsTester() .addEqualityGroup(new Ip4Address("0.0.0.1", "00:00:00:00:00:02"), new Ip4Address(1L, 2L)) .addEqualityGroup(new Ip4Address("0.0.0.1", "00:00:00:00:00:00"), new Ip4Address(1L, 0L), new Ip4Address(1L, 0L), new Ip4Address(1L), new Ip4Address("0.0.0.1")) .testEquals(); }
@Override public boolean equals(final Object that) { if (that instanceof Ip4Address) { final Ip4Address ip4 = (Ip4Address) that; return _addr.equals(ip4._addr) && (_mac == ip4._mac || _mac.equals(ip4._mac)); } else { return false; } }
Ip4Address { @Override public boolean equals(final Object that) { if (that instanceof Ip4Address) { final Ip4Address ip4 = (Ip4Address) that; return _addr.equals(ip4._addr) && (_mac == ip4._mac || _mac.equals(ip4._mac)); } else { return false; } } }
Ip4Address { @Override public boolean equals(final Object that) { if (that instanceof Ip4Address) { final Ip4Address ip4 = (Ip4Address) that; return _addr.equals(ip4._addr) && (_mac == ip4._mac || _mac.equals(ip4._mac)); } else { return false; } } Ip4Address(final long addr, final long mac);  Ip4Address(final String addr);  Ip4Address(final String addr, final String mac);  Ip4Address(final long addr); }
Ip4Address { @Override public boolean equals(final Object that) { if (that instanceof Ip4Address) { final Ip4Address ip4 = (Ip4Address) that; return _addr.equals(ip4._addr) && (_mac == ip4._mac || _mac.equals(ip4._mac)); } else { return false; } } Ip4Address(final long addr, final long mac);  Ip4Address(final String addr);  Ip4Address(final String addr, final String mac);  Ip4Address(final long addr); String ip4(); String mac(); long toLong(); boolean isSameAddressAs(final Object other); @Override int hashCode(); @Override boolean equals(final Object that); }
Ip4Address { @Override public boolean equals(final Object that) { if (that instanceof Ip4Address) { final Ip4Address ip4 = (Ip4Address) that; return _addr.equals(ip4._addr) && (_mac == ip4._mac || _mac.equals(ip4._mac)); } else { return false; } } Ip4Address(final long addr, final long mac);  Ip4Address(final String addr);  Ip4Address(final String addr, final String mac);  Ip4Address(final long addr); String ip4(); String mac(); long toLong(); boolean isSameAddressAs(final Object other); @Override int hashCode(); @Override boolean equals(final Object that);  }