@Test public void testEquals() { ResourceAllocation alloc1 = new ResourceAllocation(Resources.discrete(D1, P1, VLAN1).resource(), RCID1); ResourceAllocation sameAsAlloc1 = new ResourceAllocation(Resources.discrete(D1, P1, VLAN1).resource(), RCID1); ResourceAllocation alloc2 = new ResourceAllocation(Resources.discrete(D2, P2, VLAN2).resource(), RCID2); ResourceAllocation sameAsAlloc2 = new ResourceAllocation(Resources.discrete(D2, P2, VLAN2).resource(), RCID2); new EqualsTester() .addEqualityGroup(alloc1, sameAsAlloc1) .addEqualityGroup(alloc2, sameAsAlloc2) .testEquals(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ResourceAllocation)) { return false; } final ResourceAllocation that = (ResourceAllocation) obj; return Objects.equals(this.resource, that.resource) && Objects.equals(this.consumerId, that.consumerId); }
ResourceAllocation { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ResourceAllocation)) { return false; } final ResourceAllocation that = (ResourceAllocation) obj; return Objects.equals(this.resource, that.resource) && Objects.equals(this.consumerId, that.consumerId); } }
ResourceAllocation { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ResourceAllocation)) { return false; } final ResourceAllocation that = (ResourceAllocation) obj; return Objects.equals(this.resource, that.resource) && Objects.equals(this.consumerId, that.consumerId); } ResourceAllocation(Resource resource, ResourceConsumerId consumerId);  ResourceAllocation(Resource resource, ResourceConsumer consumer); private  ResourceAllocation(); }
ResourceAllocation { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ResourceAllocation)) { return false; } final ResourceAllocation that = (ResourceAllocation) obj; return Objects.equals(this.resource, that.resource) && Objects.equals(this.consumerId, that.consumerId); } ResourceAllocation(Resource resource, ResourceConsumerId consumerId);  ResourceAllocation(Resource resource, ResourceConsumer consumer); private  ResourceAllocation(); Resource resource(); ResourceConsumerId consumerId(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
ResourceAllocation { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ResourceAllocation)) { return false; } final ResourceAllocation that = (ResourceAllocation) obj; return Objects.equals(this.resource, that.resource) && Objects.equals(this.consumerId, that.consumerId); } ResourceAllocation(Resource resource, ResourceConsumerId consumerId);  ResourceAllocation(Resource resource, ResourceConsumer consumer); private  ResourceAllocation(); Resource resource(); ResourceConsumerId consumerId(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }