@Test public void testSatisfiesGreaterOrEqual() throws Exception { { Version version = new Version("27.0.0"); Assert.assertTrue(version.satisfies(">=27.0.0")); } { Version version = new Version("27.0.1"); Assert.assertTrue(version.satisfies(">=27.0")); } { Version version = new Version("27.1.0"); Assert.assertTrue(version.satisfies(">=27")); } { Version version = new Version("27.0.0"); Assert.assertFalse(version.satisfies(">=27.1.0")); } { Version version = new Version("27"); Assert.assertTrue(version.satisfies(">=26.9999999.9999999.99999999.99999999999")); } { Version version = new Version("20171018"); Assert.assertTrue(version.satisfies(">=20161018")); Assert.assertFalse(version.satisfies("20161018")); } { Version version = new Version("27.0.0"); Assert.assertFalse(version.satisfies("27.0.0-SNAPSHOT")); Assert.assertTrue(version.satisfies(">=27.0.0-SNAPSHOT")); } { Version version = new Version("28.0.0"); Assert.assertFalse(version.satisfies("27.0.0-SNAPSHOT")); Assert.assertTrue(version.satisfies(">=27.0.0-SNAPSHOT")); } { Version version = new Version("28.0.0"); Assert.assertTrue(version.satisfies(">=28.0.0-beta.2")); } { Version version = new Version("28.0.0"); Assert.assertTrue(version.satisfies(">=28.0.0-beta.2+build.3")); } { Version version = new Version("28.0.0"); Assert.assertTrue(version.satisfies(">=28.0.0-alpha1")); } { Version version = new Version("28.0.0"); Assert.assertTrue(version.satisfies(">=28.0.0-beta01")); } { Version version = new Version("28.0.0"); Assert.assertTrue(version.satisfies(">=28.0.0-rc02")); } { Version version = new Version("28.0.0-rc02"); Assert.assertTrue(version.satisfies(">=25.3.1")); } }
public boolean satisfies(String expr) { try { return ExpressionParser.INSTANCE.parse(expr).interpret(this); } catch (ParseException e) { e.printStackTrace(); return false; } }
Version implements Comparable<Version> { public boolean satisfies(String expr) { try { return ExpressionParser.INSTANCE.parse(expr).interpret(this); } catch (ParseException e) { e.printStackTrace(); return false; } } }
Version implements Comparable<Version> { public boolean satisfies(String expr) { try { return ExpressionParser.INSTANCE.parse(expr).interpret(this); } catch (ParseException e) { e.printStackTrace(); return false; } } Version(String version); }
Version implements Comparable<Version> { public boolean satisfies(String expr) { try { return ExpressionParser.INSTANCE.parse(expr).interpret(this); } catch (ParseException e) { e.printStackTrace(); return false; } } Version(String version); boolean satisfies(String expr); int compareTo(Version o); String toString(); boolean equals(Object o); int hashCode(); boolean greaterThan(Version other); boolean greaterThanOrEqualTo(Version other); boolean lessThan(Version other); boolean lessThanOrEqualTo(Version other); }
Version implements Comparable<Version> { public boolean satisfies(String expr) { try { return ExpressionParser.INSTANCE.parse(expr).interpret(this); } catch (ParseException e) { e.printStackTrace(); return false; } } Version(String version); boolean satisfies(String expr); int compareTo(Version o); String toString(); boolean equals(Object o); int hashCode(); boolean greaterThan(Version other); boolean greaterThanOrEqualTo(Version other); boolean lessThan(Version other); boolean lessThanOrEqualTo(Version other);  }