@Test public void testEquals() { RouterGateway routerGateway1 = RouterGateway.routerGateway(networkId1, true, fixedIpSet1); RouterGateway routerGateway2 = RouterGateway.routerGateway(networkId1, true, fixedIpSet1); RouterGateway routerGateway3 = RouterGateway.routerGateway(networkId2, true, fixedIpSet2); new EqualsTester().addEqualityGroup(routerGateway1, routerGateway2) .addEqualityGroup(routerGateway3).testEquals(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof RouterGateway) { final RouterGateway that = (RouterGateway) obj; return Objects.equals(this.networkId, that.networkId) && Objects.equals(this.enableSnat, that.enableSnat) && Objects.equals(this.externalFixedIps, that.externalFixedIps); } return false; }
RouterGateway { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof RouterGateway) { final RouterGateway that = (RouterGateway) obj; return Objects.equals(this.networkId, that.networkId) && Objects.equals(this.enableSnat, that.enableSnat) && Objects.equals(this.externalFixedIps, that.externalFixedIps); } return false; } }
RouterGateway { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof RouterGateway) { final RouterGateway that = (RouterGateway) obj; return Objects.equals(this.networkId, that.networkId) && Objects.equals(this.enableSnat, that.enableSnat) && Objects.equals(this.externalFixedIps, that.externalFixedIps); } return false; } private  RouterGateway(TenantNetworkId networkId, boolean enableSnat,
                         Set<FixedIp> externalFixedIps); }
RouterGateway { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof RouterGateway) { final RouterGateway that = (RouterGateway) obj; return Objects.equals(this.networkId, that.networkId) && Objects.equals(this.enableSnat, that.enableSnat) && Objects.equals(this.externalFixedIps, that.externalFixedIps); } return false; } private  RouterGateway(TenantNetworkId networkId, boolean enableSnat,
                         Set<FixedIp> externalFixedIps); static RouterGateway routerGateway(TenantNetworkId networkId, boolean enableSnat,
                                              Set<FixedIp> externalFixedIps); TenantNetworkId networkId(); boolean enableSnat(); Collection<FixedIp> externalFixedIps(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
RouterGateway { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof RouterGateway) { final RouterGateway that = (RouterGateway) obj; return Objects.equals(this.networkId, that.networkId) && Objects.equals(this.enableSnat, that.enableSnat) && Objects.equals(this.externalFixedIps, that.externalFixedIps); } return false; } private  RouterGateway(TenantNetworkId networkId, boolean enableSnat,
                         Set<FixedIp> externalFixedIps); static RouterGateway routerGateway(TenantNetworkId networkId, boolean enableSnat,
                                              Set<FixedIp> externalFixedIps); TenantNetworkId networkId(); boolean enableSnat(); Collection<FixedIp> externalFixedIps(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }