VersionRange { public boolean contains(String version) { if (version == null || !isValid()) { return false; } boolean isStartVersionOk = isStartVersionIncluded() ? getStartVersion().compareTo(version) <= 0 : getStartVersion().isEmpty() || getStartVersion().compareTo(version) < 0; boolean isEndVersionOk = isEndVersionIncluded() ? getEndVersion().compareTo(version) >= 0 : getEndVersion().isEmpty() || getEndVersion().compareTo(version) > 0; return isStartVersionOk && isEndVersionOk; } VersionRange(String range); boolean isValid(); String getEndVersion(); boolean isEndVersionIncluded(); String getStartVersion(); boolean isStartVersionIncluded(); boolean contains(String version);  }
@Test public void testContains() { assertThat(new VersionRange(range).contains(testVersion), equalTo(contains)); }