@Test public void testEquals() { FixedIp fixedIp1 = FixedIp.fixedIp(subnetId1, ip1); FixedIp fixedIp2 = FixedIp.fixedIp(subnetId1, ip1); FixedIp fixedIp3 = FixedIp.fixedIp(subnetId2, ip2); new EqualsTester().addEqualityGroup(fixedIp1, fixedIp2) .addEqualityGroup(fixedIp3).testEquals(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof FixedIp) { final FixedIp that = (FixedIp) obj; return Objects.equals(this.subnetId, that.subnetId) && Objects.equals(this.ip, that.ip); } return false; }
FixedIp { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof FixedIp) { final FixedIp that = (FixedIp) obj; return Objects.equals(this.subnetId, that.subnetId) && Objects.equals(this.ip, that.ip); } return false; } }
FixedIp { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof FixedIp) { final FixedIp that = (FixedIp) obj; return Objects.equals(this.subnetId, that.subnetId) && Objects.equals(this.ip, that.ip); } return false; } private  FixedIp(SubnetId subnetId, IpAddress ip); }
FixedIp { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof FixedIp) { final FixedIp that = (FixedIp) obj; return Objects.equals(this.subnetId, that.subnetId) && Objects.equals(this.ip, that.ip); } return false; } private  FixedIp(SubnetId subnetId, IpAddress ip); SubnetId subnetId(); IpAddress ip(); static FixedIp fixedIp(SubnetId subnetId, IpAddress ip); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
FixedIp { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof FixedIp) { final FixedIp that = (FixedIp) obj; return Objects.equals(this.subnetId, that.subnetId) && Objects.equals(this.ip, that.ip); } return false; } private  FixedIp(SubnetId subnetId, IpAddress ip); SubnetId subnetId(); IpAddress ip(); static FixedIp fixedIp(SubnetId subnetId, IpAddress ip); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }