public boolean contains(Version apiVersion) {
        return this != EMPTY
                && apiVersion != null
                && (from == null || from.compareTo(apiVersion) <= 0 && (to == null || to.compareTo(apiVersion) >= 0));
    }
@Test
    public void testContains() {

        assertTrue(ApiVersion.parseRange("v1").contains(ApiVersion.parse("v1")));
        assertFalse(ApiVersion.parseRange("v1").contains(ApiVersion.parse("v1alpha1")));
        assertFalse(ApiVersion.parseRange("v1").contains(ApiVersion.parse("v1beta1")));
        assertFalse(ApiVersion.parseRange("v1").contains(ApiVersion.parse("v2")));

        assertTrue(ApiVersion.parseRange("v1alpha1-v1").contains(ApiVersion.parse("v1alpha1")));
        assertTrue(ApiVersion.parseRange("v1alpha1-v1").contains(ApiVersion.parse("v1alpha2")));
        assertTrue(ApiVersion.parseRange("v1alpha1-v1").contains(ApiVersion.parse("v1beta1")));
        assertTrue(ApiVersion.parseRange("v1alpha1-v1").contains(ApiVersion.parse("v1beta2")));
        assertTrue(ApiVersion.parseRange("v1alpha1-v1").contains(ApiVersion.parse("v1")));
        assertFalse(ApiVersion.parseRange("v1alpha1-v1").contains(ApiVersion.parse("v0")));
        assertFalse(ApiVersion.parseRange("v1alpha1-v1").contains(ApiVersion.parse("v2alpha1")));
        assertFalse(ApiVersion.parseRange("v1alpha1-v1").contains(ApiVersion.parse("v2beta1")));
        assertFalse(ApiVersion.parseRange("v1alpha1-v1").contains(ApiVersion.parse("v2")));

        assertTrue(ApiVersion.parseRange("v1alpha1+").contains(ApiVersion.parse("v1alpha1")));
        assertTrue(ApiVersion.parseRange("v1alpha1+").contains(ApiVersion.parse("v1alpha2")));
        assertTrue(ApiVersion.parseRange("v1alpha1+").contains(ApiVersion.parse("v1beta1")));
        assertTrue(ApiVersion.parseRange("v1alpha1+").contains(ApiVersion.parse("v1beta2")));
        assertTrue(ApiVersion.parseRange("v1alpha1+").contains(ApiVersion.parse("v1")));
        assertFalse(ApiVersion.parseRange("v1alpha1+").contains(ApiVersion.parse("v0")));
        assertTrue(ApiVersion.parseRange("v1alpha1+").contains(ApiVersion.parse("v2alpha1")));
        assertTrue(ApiVersion.parseRange("v1alpha1+").contains(ApiVersion.parse("v2beta1")));
        assertTrue(ApiVersion.parseRange("v1alpha1+").contains(ApiVersion.parse("v2")));

        assertTrue(ApiVersion.parseRange("all").contains(ApiVersion.parse("v1alpha1")));
        assertTrue(ApiVersion.parseRange("all").contains(ApiVersion.parse("v1alpha2")));
        assertTrue(ApiVersion.parseRange("all").contains(ApiVersion.parse("v1beta1")));
        assertTrue(ApiVersion.parseRange("all").contains(ApiVersion.parse("v1beta2")));
        assertTrue(ApiVersion.parseRange("all").contains(ApiVersion.parse("v1")));
        assertTrue(ApiVersion.parseRange("all").contains(ApiVersion.parse("v0")));
        assertTrue(ApiVersion.parseRange("all").contains(ApiVersion.parse("v2alpha1")));
        assertTrue(ApiVersion.parseRange("all").contains(ApiVersion.parse("v2beta1")));
        assertTrue(ApiVersion.parseRange("all").contains(ApiVersion.parse("v2")));
    }