aboutsummaryrefslogtreecommitdiffstats
path: root/api/src/test/java/org/semver/VersionTest.java
diff options
context:
space:
mode:
authorAlexander Morozov <[email protected]>2014-10-01 13:41:42 +0700
committerAlexander Morozov <[email protected]>2014-10-01 13:41:42 +0700
commit95232052f900ac565917246b29b56b058cc060da (patch)
tree8254007571478526443aacef36adf8b77d8bbf53 /api/src/test/java/org/semver/VersionTest.java
parentb39561c4ade1279eeae42156c741c92529bb2d80 (diff)
Add version compatibility checking. AbstractEnforcerRule will skip non-compatible artifacts in case of auto-detection of previous version .
Diffstat (limited to 'api/src/test/java/org/semver/VersionTest.java')
-rwxr-xr-xapi/src/test/java/org/semver/VersionTest.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/api/src/test/java/org/semver/VersionTest.java b/api/src/test/java/org/semver/VersionTest.java
index 6fbcf47..625c3ac 100755
--- a/api/src/test/java/org/semver/VersionTest.java
+++ b/api/src/test/java/org/semver/VersionTest.java
@@ -102,6 +102,20 @@ public class VersionTest {
}
@Test
+ public void shouldBeCompatible() {
+ Assert.assertTrue(Version.parse("1.0.0").isCompatible(Version.parse("1.2.3-SNAPSHOT")));
+ Assert.assertTrue(Version.parse("1.0.0").isCompatible(Version.parse("1.0.1")));
+ Assert.assertTrue(Version.parse("1.0.0").isCompatible(Version.parse("1.1.0")));
+ }
+
+ @Test
+ public void shouldBeIncompatible() {
+ Assert.assertFalse(Version.parse("0.0.1-SNAPSHOT").isCompatible(null));
+ Assert.assertFalse(Version.parse("1.0.1").isCompatible(Version.parse("2.0.0")));
+ Assert.assertFalse(Version.parse("1.1.0-rc3").isCompatible(Version.parse("3.1.0-SNAPSHOT")));
+ }
+
+ @Test
public void isNewer() {
Assert.assertTrue(Version.parse("3.2.3").compareTo(Version.parse("3.2-M1-SNAPSHOT")) > 0);
Assert.assertTrue(Version.parse("1.0.0").compareTo(Version.parse("0.0.0")) > 0);