@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);
    }
@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();
    }