### Question:
Versions { public static VersionRange parseVersionRange(String range) throws VersionException { Assert.notNull(range, "Version range must not be null."); boolean lowerBoundInclusive = range.startsWith("["); boolean upperBoundInclusive = range.endsWith("]"); String process = range.substring(1, range.length() - 1).trim(); VersionRange result; int index = process.indexOf(","); if (index < 0) { if (!lowerBoundInclusive || !upperBoundInclusive) { throw new VersionException("Single version must be surrounded by []: " + range); } Version version = SingleVersion.valueOf(process); result = new DefaultVersionRange(version, lowerBoundInclusive, version, upperBoundInclusive); } else { String lowerBound = process.substring(0, index).trim(); String upperBound = process.substring(index + 1).trim(); if (lowerBound.equals(upperBound)) { throw new VersionException("Range cannot have identical boundaries: " + range); } Version lowerVersion = null; if (lowerBound.length() > 0) { lowerVersion = SingleVersion.valueOf(lowerBound); } Version upperVersion = null; if (upperBound.length() > 0) { upperVersion = SingleVersion.valueOf(upperBound); } if (upperVersion != null && lowerVersion != null && upperVersion.compareTo(lowerVersion) < 0) { throw new VersionException("Range defies version ordering: " + range); } result = new DefaultVersionRange(lowerVersion, lowerBoundInclusive, upperVersion, upperBoundInclusive); } return result; }  static boolean isApiCompatible(Version runtimeVersion, Version addonApiVersion); static VersionRange parseVersionRange(String range); static MultipleVersionRange parseMultipleVersionRange(String intersection); static VersionRange intersection(VersionRange... ranges); static VersionRange intersection(Collection<VersionRange> ranges); static boolean isSnapshot(Version version); static Version getSpecificationVersionFor(Class<?> type); static Version getImplementationVersionFor(Class<?> type);  }### Answer:
@Test public void testVersionRangeSame() throws Exception { VersionRange range = Versions.parseVersionRange("[7]"); Assert.assertEquals(SingleVersion.valueOf("7"), range.getMin()); Assert.assertEquals(SingleVersion.valueOf("7"), range.getMax()); Assert.assertEquals("[7]", range.toString()); }
@Test public void testParseVersionRange() throws Exception { VersionRange range = Versions.parseVersionRange("[0,15]"); Assert.assertEquals(SingleVersion.valueOf("0"), range.getMin()); Assert.assertEquals(SingleVersion.valueOf("15"), range.getMax()); Assert.assertTrue(range.isMinInclusive()); Assert.assertTrue(range.isMaxInclusive()); }