@Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        final DiscreteResource other = (DiscreteResource) obj;
        // the value returing from volume() is excluded due to optimization
        return Objects.equals(this.id, other.id);
    }
@Test
    public void testEquals() {
        DiscreteResource resource1 = Resources.discrete(D1, P1, VLAN1).resource();
        DiscreteResource sameAsResource1 = Resources.discrete(D1, P1, VLAN1).resource();
        DiscreteResource resource2 = Resources.discrete(D2, P1, VLAN1).resource();

        new EqualsTester()
                .addEqualityGroup(resource1, sameAsResource1)
                .addEqualityGroup(resource2)
                .testEquals();
    }