@Test void isCompatible() throws InvalidVersionRangeException { assertTrue(new DefaultVersionRange("[1.0]").isCompatible(new DefaultVersionRange("[1.0]"))); assertTrue(new DefaultVersionRange("[1.0,2.0]").isCompatible(new DefaultVersionRange("[1.0]"))); assertTrue(new DefaultVersionRange("[1.0,2.0]").isCompatible(new DefaultVersionRange("[1.0,3.0]"))); assertTrue(new DefaultVersionRange("[1.0,2.0]").isCompatible(new DefaultVersionRange("[2.0,3.0]"))); assertTrue(new DefaultVersionRange("(,2.0]").isCompatible(new DefaultVersionRange("[2.0,)"))); assertTrue(new DefaultVersionRange("(,2.0]").isCompatible(new DefaultVersionRange("[1.0,)"))); assertTrue(new DefaultVersionRange("(,2.0)").isCompatible(new DefaultVersionRange("(1.0,)"))); assertFalse(new DefaultVersionRange("[1.0,2.0)").isCompatible(new DefaultVersionRange("(2.0,3.0]"))); assertFalse(new DefaultVersionRange("(,2.0)").isCompatible(new DefaultVersionRange("(2.0,)"))); assertFalse(new DefaultVersionRange("[1.0]").isCompatible(new DefaultVersionRange("[2.0]"))); }
@Override public boolean isCompatible(VersionRange otherRange) { boolean compatible; if (equals(otherRange)) { compatible = true; } else { if (otherRange instanceof DefaultVersionRange) { compatible = isCompatible((DefaultVersionRange) otherRange); } else { try { compatible = isCompatible(new DefaultVersionRange(otherRange.getValue())); } catch (InvalidVersionRangeException e) { compatible = false; } } } return compatible; }
DefaultVersionRange implements VersionRange { @Override public boolean isCompatible(VersionRange otherRange) { boolean compatible; if (equals(otherRange)) { compatible = true; } else { if (otherRange instanceof DefaultVersionRange) { compatible = isCompatible((DefaultVersionRange) otherRange); } else { try { compatible = isCompatible(new DefaultVersionRange(otherRange.getValue())); } catch (InvalidVersionRangeException e) { compatible = false; } } } return compatible; } }
DefaultVersionRange implements VersionRange { @Override public boolean isCompatible(VersionRange otherRange) { boolean compatible; if (equals(otherRange)) { compatible = true; } else { if (otherRange instanceof DefaultVersionRange) { compatible = isCompatible((DefaultVersionRange) otherRange); } else { try { compatible = isCompatible(new DefaultVersionRange(otherRange.getValue())); } catch (InvalidVersionRangeException e) { compatible = false; } } } return compatible; } DefaultVersionRange(String rawRange);  DefaultVersionRange(Version lowerBound, boolean lowerBoundInclusive, Version upperBound,
        boolean upperBoundInclusive); }
DefaultVersionRange implements VersionRange { @Override public boolean isCompatible(VersionRange otherRange) { boolean compatible; if (equals(otherRange)) { compatible = true; } else { if (otherRange instanceof DefaultVersionRange) { compatible = isCompatible((DefaultVersionRange) otherRange); } else { try { compatible = isCompatible(new DefaultVersionRange(otherRange.getValue())); } catch (InvalidVersionRangeException e) { compatible = false; } } } return compatible; } DefaultVersionRange(String rawRange);  DefaultVersionRange(Version lowerBound, boolean lowerBoundInclusive, Version upperBound,
        boolean upperBoundInclusive); Version getLowerBound(); Version getUpperBound(); @Override boolean containsVersion(Version version); boolean containsVersion(DefaultVersion version); @Override String getValue(); @Override boolean isCompatible(VersionRange otherRange); boolean isCompatible(DefaultVersionRange otherRange); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); boolean equals(DefaultVersionRange version); }
DefaultVersionRange implements VersionRange { @Override public boolean isCompatible(VersionRange otherRange) { boolean compatible; if (equals(otherRange)) { compatible = true; } else { if (otherRange instanceof DefaultVersionRange) { compatible = isCompatible((DefaultVersionRange) otherRange); } else { try { compatible = isCompatible(new DefaultVersionRange(otherRange.getValue())); } catch (InvalidVersionRangeException e) { compatible = false; } } } return compatible; } DefaultVersionRange(String rawRange);  DefaultVersionRange(Version lowerBound, boolean lowerBoundInclusive, Version upperBound,
        boolean upperBoundInclusive); Version getLowerBound(); Version getUpperBound(); @Override boolean containsVersion(Version version); boolean containsVersion(DefaultVersion version); @Override String getValue(); @Override boolean isCompatible(VersionRange otherRange); boolean isCompatible(DefaultVersionRange otherRange); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); boolean equals(DefaultVersionRange version);  }