@Test public void testEquals() { AllocationPool pool1 = new DefaultAllocationPool(startIP1, endIP1); AllocationPool pool2 = new DefaultAllocationPool(startIP1, endIP1); AllocationPool pool3 = new DefaultAllocationPool(startIP2, endIP2); new EqualsTester().addEqualityGroup(pool1, pool2) .addEqualityGroup(pool3).testEquals(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof DefaultAllocationPool) { final DefaultAllocationPool other = (DefaultAllocationPool) obj; return Objects.equals(this.startIp, other.startIp) && Objects.equals(this.endIp, other.endIp); } return false; }
DefaultAllocationPool implements AllocationPool { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof DefaultAllocationPool) { final DefaultAllocationPool other = (DefaultAllocationPool) obj; return Objects.equals(this.startIp, other.startIp) && Objects.equals(this.endIp, other.endIp); } return false; } }
DefaultAllocationPool implements AllocationPool { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof DefaultAllocationPool) { final DefaultAllocationPool other = (DefaultAllocationPool) obj; return Objects.equals(this.startIp, other.startIp) && Objects.equals(this.endIp, other.endIp); } return false; } DefaultAllocationPool(IpAddress startIp, IpAddress endIp); }
DefaultAllocationPool implements AllocationPool { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof DefaultAllocationPool) { final DefaultAllocationPool other = (DefaultAllocationPool) obj; return Objects.equals(this.startIp, other.startIp) && Objects.equals(this.endIp, other.endIp); } return false; } DefaultAllocationPool(IpAddress startIp, IpAddress endIp); @Override IpAddress startIp(); @Override IpAddress endIp(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
DefaultAllocationPool implements AllocationPool { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof DefaultAllocationPool) { final DefaultAllocationPool other = (DefaultAllocationPool) obj; return Objects.equals(this.startIp, other.startIp) && Objects.equals(this.endIp, other.endIp); } return false; } DefaultAllocationPool(IpAddress startIp, IpAddress endIp); @Override IpAddress startIp(); @Override IpAddress endIp(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }