コード例 #1
0
 @Test(timeout = 5000)
 public void testInvalidVersions() {
   Assert.assertEquals(-1, comparator.compare("x.1", "x.1"));
   Assert.assertEquals(-1, comparator.compare("x.1", "0.1"));
   Assert.assertEquals(-1, comparator.compare("1.x", "1.1"));
   Assert.assertEquals(-1, comparator.compare("1.1", "x.1"));
   Assert.assertEquals(-1, comparator.compare("1.1", "1.x"));
   Assert.assertEquals(-1, comparator.compare("1.1", "Unknown"));
   Assert.assertEquals(-1, comparator.compare("Unknown", "1.1"));
   Assert.assertEquals(-1, comparator.compare("Unknown", "Unknown"));
 }
コード例 #2
0
 @Test(timeout = 5000)
 public void testBasicEqualChecks() {
   Assert.assertEquals(0, comparator.compare("1-SNAPSHOT", "1-SNAPSHOT"));
   Assert.assertEquals(0, comparator.compare("1.1-SNAPSHOT", "1.1-SNAPSHOT"));
   Assert.assertEquals(0, comparator.compare("1.1.0-SNAPSHOT", "1.1.0-SNAPSHOT"));
   Assert.assertEquals(0, comparator.compare("0.1.0", "0.1.0"));
   Assert.assertEquals(0, comparator.compare("0.1", "0.1"));
   Assert.assertEquals(0, comparator.compare("0.1.2", "0.1.3"));
   Assert.assertEquals(0, comparator.compare("1.1.2", "1.1.5-RC"));
   Assert.assertEquals(0, comparator.compare("1", "1"));
   Assert.assertEquals(0, comparator.compare("1.1.x", "1.1.x"));
   Assert.assertEquals(0, comparator.compare("1-SNAP.x", "1-SNAP.x"));
 }
コード例 #3
0
 @Test(timeout = 5000)
 public void testInequalityChecks() {
   Assert.assertEquals(-1, comparator.compare("1.1", "2.1"));
   Assert.assertEquals(1, comparator.compare("1.1", "0.1"));
   Assert.assertEquals(1, comparator.compare("1.1.2", "0.1.2"));
   Assert.assertEquals(-1, comparator.compare("1.1.9", "4.1.9"));
   Assert.assertEquals(-1, comparator.compare("1.1-RC", "2.1.x"));
   Assert.assertEquals(-1, comparator.compare("1.1", ""));
   Assert.assertEquals(-1, comparator.compare("", "1.1"));
 }