@Test
public void testVersionRange() throws Exception {

  String version1 = "[1.2.3, 4.5.6]";
  String version2="(1, 2]";
  String version3="[2,4)";
  String version4="(1,2)";
  String version5="2";
  String version6 = "2.3";
  String version7="[1.2.3.q, 2.3.4.p)";
  String version8="1.2.2.5";
  String version9="a.b.c";
  String version10=null;
  String version11="";
  String version12="\"[1.2.3, 4.5.6]\"";
  
  VersionRange vr = new VersionRange(version1);
  assertEquals("The value is wrong", "1.2.3", vr.getMinimumVersion().toString());
  assertFalse("The value is wrong", vr.isMinimumExclusive());
  assertEquals("The value is wrong", "4.5.6", vr.getMaximumVersion().toString());
  assertFalse("The value is wrong", vr.isMaximumExclusive());
  
  vr = new VersionRange(version2);
  assertEquals("The value is wrong", "1.0.0", vr.getMinimumVersion().toString());
  assertTrue("The value is wrong", vr.isMinimumExclusive());
  assertEquals("The value is wrong", "2.0.0", vr.getMaximumVersion().toString());
  assertFalse("The value is wrong", vr.isMaximumExclusive());
  
  vr = new VersionRange(version3);
  
  assertEquals("The value is wrong", "2.0.0", vr.getMinimumVersion().toString());
  assertFalse("The value is wrong", vr.isMinimumExclusive());
  assertEquals("The value is wrong", "4.0.0", vr.getMaximumVersion().toString());
  assertTrue("The value is wrong", vr.isMaximumExclusive());
  
  vr = new VersionRange(version4);
  
  assertEquals("The value is wrong", "1.0.0", vr.getMinimumVersion().toString());
  assertTrue("The value is wrong", vr.isMinimumExclusive());
  assertEquals("The value is wrong", "2.0.0", vr.getMaximumVersion().toString());
  assertTrue("The value is wrong", vr.isMaximumExclusive());
  
  vr = new VersionRange(version5);
  assertEquals("The value is wrong", "2.0.0", vr.getMinimumVersion().toString());
  assertFalse("The value is wrong", vr.isMinimumExclusive());
  assertNull("The value is wrong", vr.getMaximumVersion());
  assertFalse("The value is wrong", vr.isMaximumExclusive());
  
  vr = new VersionRange(version6);
  assertEquals("The value is wrong", "2.3.0", vr.getMinimumVersion().toString());
  assertFalse("The value is wrong", vr.isMinimumExclusive());
  assertNull("The value is wrong", vr.getMaximumVersion());
  assertFalse("The value is wrong", vr.isMaximumExclusive());
  
  vr = new VersionRange(version7);
  assertEquals("The value is wrong", "1.2.3.q", vr.getMinimumVersion().toString());
  assertFalse("The value is wrong", vr.isMinimumExclusive());
  assertEquals("The value is wrong", "2.3.4.p", vr.getMaximumVersion().toString());
  assertTrue("The value is wrong", vr.isMaximumExclusive());
  
  vr = new VersionRange(version8);
  assertEquals("The value is wrong", "1.2.2.5", vr.getMinimumVersion().toString());
  assertFalse("The value is wrong", vr.isMinimumExclusive());
  assertNull("The value is wrong", vr.getMaximumVersion());
  assertFalse("The value is wrong", vr.isMaximumExclusive());
  boolean exception = false;
  try {
  vr = new VersionRange(version9);
  } catch (Exception e){
    exception = true;
  }
  
  assertTrue("The value is wrong", exception);
  boolean exceptionNull = false;
  try {
    vr = new VersionRange(version10);
  } catch (Exception e){
    exceptionNull = true;
  }
  assertTrue("The value is wrong", exceptionNull);
  // empty version should be defaulted to >=0.0.0
  vr = new VersionRange(version11);
  assertEquals("The value is wrong", "0.0.0", vr.getMinimumVersion().toString());
  assertFalse("The value is wrong", vr.isMinimumExclusive());
  assertNull("The value is wrong", vr.getMaximumVersion());
  assertFalse("The value is wrong", vr.isMaximumExclusive());
  vr = new VersionRange(version12);
  assertEquals("The value is wrong", "1.2.3", vr.getMinimumVersion().toString());
  assertFalse("The value is wrong", vr.isMinimumExclusive());
  assertEquals("The value is wrong", "4.5.6", vr.getMaximumVersion().toString());
  assertFalse("The value is wrong", vr.isMaximumExclusive());  
}