@Test public void testEquals() { AllowedAddressPair p1 = AllowedAddressPair .allowedAddressPair(ip1, mac1); AllowedAddressPair p2 = AllowedAddressPair .allowedAddressPair(ip1, mac1); AllowedAddressPair p3 = AllowedAddressPair .allowedAddressPair(ip2, mac2); new EqualsTester().addEqualityGroup(p1, p2).addEqualityGroup(p3) .testEquals(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof AllowedAddressPair) { final AllowedAddressPair that = (AllowedAddressPair) obj; return Objects.equals(this.ip, that.ip) && Objects.equals(this.mac, that.mac); } return false; }
AllowedAddressPair { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof AllowedAddressPair) { final AllowedAddressPair that = (AllowedAddressPair) obj; return Objects.equals(this.ip, that.ip) && Objects.equals(this.mac, that.mac); } return false; } }
AllowedAddressPair { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof AllowedAddressPair) { final AllowedAddressPair that = (AllowedAddressPair) obj; return Objects.equals(this.ip, that.ip) && Objects.equals(this.mac, that.mac); } return false; } private  AllowedAddressPair(IpAddress ip, MacAddress mac); }
AllowedAddressPair { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof AllowedAddressPair) { final AllowedAddressPair that = (AllowedAddressPair) obj; return Objects.equals(this.ip, that.ip) && Objects.equals(this.mac, that.mac); } return false; } private  AllowedAddressPair(IpAddress ip, MacAddress mac); IpAddress ip(); MacAddress mac(); static AllowedAddressPair allowedAddressPair(IpAddress ip,
                                                        MacAddress mac); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
AllowedAddressPair { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof AllowedAddressPair) { final AllowedAddressPair that = (AllowedAddressPair) obj; return Objects.equals(this.ip, that.ip) && Objects.equals(this.mac, that.mac); } return false; } private  AllowedAddressPair(IpAddress ip, MacAddress mac); IpAddress ip(); MacAddress mac(); static AllowedAddressPair allowedAddressPair(IpAddress ip,
                                                        MacAddress mac); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }