public T subtract(T other) {
        checkNotNull(other, "Cannot subtract null resources");
        checkArgument(getClass() == other.getClass(), "Minus with different resource type");
        checkArgument(name.equals(other.getName()), "Minus with different resource name");
        checkArgument(
                value.compareTo(other.getValue()) >= 0,
                "Try to subtract a larger resource from this one.");

        return create(value.subtract(other.getValue()));
    }
@Test
    void testSubtractErrorOnDifferentTypes() {
        final Resource v1 = new TestResource(0.1);
        final Resource v2 = new CPUResource(0.1);
        assertThatThrownBy(() -> v1.subtract(v2)).isInstanceOf(IllegalArgumentException.class);
    }