### Question:
VersionRange implements IComparable <VersionRange> { public boolean versionMatches (@Nonnull final Version rhs) { int i = m_aFloorVersion.compareTo (rhs); if (m_bIncludeFloor ? i > 0 : i >= 0) return false; if (m_aCeilVersion != null) { i = m_aCeilVersion.compareTo (rhs); if (m_bIncludeCeil ? i < 0 : i <= 0) return false; } return true; } VersionRange(@Nonnull final Version aFloorVersion, @Nullable final Version aCeilingVersion);  VersionRange(@Nonnull final Version aFloorVersion,
                       final boolean bIncludeFloorVersion,
                       @Nullable final Version aCeilingVersion,
                       final boolean bIncludeCeilingVersion); @Nonnull static VersionRange parse(@Nullable final String sVersionString); boolean isIncludingFloor(); @Nullable Version getFloorVersion(); boolean isIncludingCeil(); @Nullable Version getCeilVersion(); boolean versionMatches(@Nonnull final Version rhs); int compareTo(@Nonnull final VersionRange rhs); @Nonnull String getAsString(); @Nonnull String getAsString(final boolean bPrintZeroElements); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); static final String DEFAULT_VERSION_RANGE_STRING; }### Answer:
@Test public void testVersionMatches () { VersionRange vr = VersionRange.parse ("[1.2.3, 4.5.6]"); assertTrue (vr.versionMatches (new Version (2))); assertTrue (vr.versionMatches (new Version (2, 99))); assertFalse (vr.versionMatches (new Version (1, 2))); assertTrue (vr.versionMatches (new Version (4, 5))); assertTrue (vr.versionMatches (new Version (1, 2, 3))); assertTrue (vr.versionMatches (new Version (1, 2, 3, "alpha"))); assertTrue (vr.versionMatches (new Version (4, 5, 6))); assertFalse (vr.versionMatches (new Version (4, 5, 6, "beta"))); vr = VersionRange.parse ("[1.2.3, 4.5.6)"); assertTrue (vr.versionMatches (new Version (2))); assertTrue (vr.versionMatches (new Version (2, 99))); assertFalse (vr.versionMatches (new Version (1, 2))); assertTrue (vr.versionMatches (new Version (4, 5))); assertTrue (vr.versionMatches (new Version (1, 2, 3))); assertTrue (vr.versionMatches (new Version (1, 2, 3, "alpha"))); assertFalse (vr.versionMatches (new Version (4, 5, 6))); assertFalse (vr.versionMatches (new Version (4, 5, 6, "beta"))); vr = VersionRange.parse ("(1.2.3, 4.5.6]"); assertTrue (vr.versionMatches (new Version (2))); assertTrue (vr.versionMatches (new Version (2, 99))); assertFalse (vr.versionMatches (new Version (1, 2))); assertTrue (vr.versionMatches (new Version (4, 5))); assertFalse (vr.versionMatches (new Version (1, 2, 3))); assertTrue (vr.versionMatches (new Version (1, 2, 3, "alpha"))); assertTrue (vr.versionMatches (new Version (4, 5, 6))); assertFalse (vr.versionMatches (new Version (4, 5, 6, "beta"))); vr = VersionRange.parse ("(1.2.3, 4.5.6)"); assertTrue (vr.versionMatches (new Version (2))); assertTrue (vr.versionMatches (new Version (2, 99))); assertFalse (vr.versionMatches (new Version (1, 2))); assertTrue (vr.versionMatches (new Version (4, 5))); assertFalse (vr.versionMatches (new Version (1, 2, 3))); assertTrue (vr.versionMatches (new Version (1, 2, 3, "alpha"))); assertFalse (vr.versionMatches (new Version (4, 5, 6))); assertFalse (vr.versionMatches (new Version (4, 5, 6, "beta"))); }