diff options
author | Julien Eluard <[email protected]> | 2014-10-01 22:08:28 -0300 |
---|---|---|
committer | Julien Eluard <[email protected]> | 2014-10-01 22:08:28 -0300 |
commit | bca36dc2202f806ecc022b8b34f110eba830fe9e (patch) | |
tree | 8254007571478526443aacef36adf8b77d8bbf53 /api/src/test/java/org/semver/VersionTest.java | |
parent | 4a2555c269d1dbc0a8f4253ded9b5719dc9146dd (diff) | |
parent | 95232052f900ac565917246b29b56b058cc060da (diff) |
Merge pull request #45 from shuraa/master
Fix regression, skip incompatible version during previous version detection.
Diffstat (limited to 'api/src/test/java/org/semver/VersionTest.java')
-rwxr-xr-x | api/src/test/java/org/semver/VersionTest.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/api/src/test/java/org/semver/VersionTest.java b/api/src/test/java/org/semver/VersionTest.java index bdefa5a..625c3ac 100755 --- a/api/src/test/java/org/semver/VersionTest.java +++ b/api/src/test/java/org/semver/VersionTest.java @@ -97,6 +97,25 @@ public class VersionTest { } @Test + public void shouldBeSnapshotVersion() { + Assert.assertTrue(Version.parse("1.5.30-SNAPSHOT").isSnapshot()); + } + + @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); |