@Override
    public DiscreteResources add(DiscreteResources other) {
        if (other instanceof GenericDiscreteResources) {
            // make sure that the set is serializable
            return of(new LinkedHashSet<>(Sets.union(this.values(), other.values())));
        } else if (other instanceof EmptyDiscreteResources) {
            return this;
        }

        return DiscreteResources.of(Sets.union(this.values(), other.values()));
    }
@Test
    public void testAdd() {
        DiscreteResource res1 = Resources.discrete(DeviceId.deviceId("a")).resource();
        DiscreteResource res2 = Resources.discrete(DeviceId.deviceId("b")).resource();

        DiscreteResources sut = GenericDiscreteResources.of(ImmutableSet.of(res1));

        DiscreteResources other = GenericDiscreteResources.of(ImmutableSet.of(res2));

        DiscreteResources expected = GenericDiscreteResources.of(ImmutableSet.of(res1, res2));
        assertThat(sut.add(other), is(expected));
    }