public boolean intersects(VersionRange<Version> other) {
        if (this == EMPTY) {
            return false;
        } else if (from == null) {
            return true;
        } else if (to == null) {
            return from.compareTo(other.from) <= 0;
        } else {
            return !(to.compareTo(other.from) < 0 || (other.to != null && from.compareTo(other.to) > 0));
        }
    }
@Test
    public void testIntersects() {
        assertTrue(ApiVersion.parseRange("v1").intersects(ApiVersion.parseRange("v1")));
        assertFalse(ApiVersion.parseRange("v1").intersects(ApiVersion.parseRange("v1alpha1")));
        assertFalse(ApiVersion.parseRange("v1").intersects(ApiVersion.parseRange("v2")));

        assertFalse(ApiVersion.parseRange("v1+").intersects(ApiVersion.parseRange("v0")));
        assertFalse(ApiVersion.parseRange("v1+").intersects(ApiVersion.parseRange("v1alpha1")));
        assertFalse(ApiVersion.parseRange("v1+").intersects(ApiVersion.parseRange("v1alpha2")));
        assertFalse(ApiVersion.parseRange("v1+").intersects(ApiVersion.parseRange("v1beta1")));
        assertFalse(ApiVersion.parseRange("v1+").intersects(ApiVersion.parseRange("v1beta2")));
        assertTrue(ApiVersion.parseRange("v1+").intersects(ApiVersion.parseRange("v1")));
        assertTrue(ApiVersion.parseRange("v1+").intersects(ApiVersion.parseRange("v2")));
        assertTrue(ApiVersion.parseRange("v1+").intersects(ApiVersion.parseRange("v4")));
        // swapped (symmetric operator)
        assertFalse(ApiVersion.parseRange("v0").intersects(ApiVersion.parseRange("v1+")));
        assertFalse(ApiVersion.parseRange("v1alpha1").intersects(ApiVersion.parseRange("v1+")));
        assertFalse(ApiVersion.parseRange("v1alpha2").intersects(ApiVersion.parseRange("v1+")));
        assertFalse(ApiVersion.parseRange("v1beta1").intersects(ApiVersion.parseRange("v1+")));
        assertFalse(ApiVersion.parseRange("v1beta2").intersects(ApiVersion.parseRange("v1+")));
        assertTrue(ApiVersion.parseRange("v1").intersects(ApiVersion.parseRange("v1+")));
        assertTrue(ApiVersion.parseRange("v2").intersects(ApiVersion.parseRange("v1+")));
        assertTrue(ApiVersion.parseRange("v4").intersects(ApiVersion.parseRange("v1+")));

        assertFalse(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v0")));
        assertFalse(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v1alpha1")));
        assertFalse(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v1alpha2")));
        assertFalse(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v1beta1")));
        assertFalse(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v1beta2")));
        assertTrue(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v1")));
        assertTrue(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v2")));
        assertTrue(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v2alpha1")));
        assertTrue(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v2beta1")));
        assertFalse(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v3alpha1")));
        assertFalse(ApiVersion.parseRange("v1-v2").intersects(ApiVersion.parseRange("v3")));
        // swapped (symmetric operator)
        assertFalse(ApiVersion.parseRange("v0").intersects(ApiVersion.parseRange("v1-v2")));
        assertFalse(ApiVersion.parseRange("v1alpha1").intersects(ApiVersion.parseRange("v1-v2")));
        assertFalse(ApiVersion.parseRange("v1alpha2").intersects(ApiVersion.parseRange("v1-v2")));
        assertFalse(ApiVersion.parseRange("v1beta1").intersects(ApiVersion.parseRange("v1-v2")));
        assertFalse(ApiVersion.parseRange("v1beta2").intersects(ApiVersion.parseRange("v1-v2")));
        assertTrue(ApiVersion.parseRange("v1").intersects(ApiVersion.parseRange("v1-v2")));
        assertTrue(ApiVersion.parseRange("v2").intersects(ApiVersion.parseRange("v1-v2")));
        assertTrue(ApiVersion.parseRange("v2alpha1").intersects(ApiVersion.parseRange("v1-v2")));
        assertTrue(ApiVersion.parseRange("v2beta1").intersects(ApiVersion.parseRange("v1-v2")));
        assertFalse(ApiVersion.parseRange("v3alpha1").intersects(ApiVersion.parseRange("v1-v2")));
        assertFalse(ApiVersion.parseRange("v3").intersects(ApiVersion.parseRange("v1-v2")));
    }