Skip to content

Commit

Permalink
Adds tests (some ignored) for new calver versioning
Browse files Browse the repository at this point in the history
See gh-193
  • Loading branch information
spencergibb committed Apr 16, 2020
1 parent 3658fcc commit 833ec47
Showing 1 changed file with 30 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public void should_get_major_from_version() {
then(projectVersion("2.0.1.M1").major()).isEqualTo("2");
then(projectVersion("2.0.1.RC1").major()).isEqualTo("2");
then(projectVersion("Finchley.SR1").major()).isEqualTo("Finchley");
then(projectVersion("2020.0.0.M1").major()).isEqualTo("2020");
//then(projectVersion("2020.0.0").major()).isEqualTo("2020");
}

@Test
Expand Down Expand Up @@ -252,6 +254,10 @@ public void should_return_false_for_rc_version() {
String version = "1.0.1.RC1";

then(projectVersion(version).isRelease()).isFalse();

String newRCSuffixVersion = "1.0.1-RC1";

then(projectVersion(newRCSuffixVersion).isRelease()).isFalse();
}

@Test
Expand Down Expand Up @@ -281,6 +287,10 @@ public void should_return_true_when_checking_milestone_version_against_milestone
String version = "1.0.1.M1";

then(projectVersion(version).isMilestone()).isTrue();

String newMilestoneSuffix = "1.0.1-M1";

then(projectVersion(newMilestoneSuffix).isMilestone()).isTrue();
}

@Test
Expand All @@ -295,12 +305,18 @@ public void should_return_true_when_checking_rc_version_against_rc() {
String version = "1.0.1.RC3";

then(projectVersion(version).isRc()).isTrue();

String newRCSuffix = "1.0.1-RC3";

then(projectVersion(newRCSuffix).isRc()).isTrue();
}

@Test
public void should_return_true_when_checking_ga_version_against_ga() {
then(projectVersion("1.0.1.RELEASE").isReleaseOrServiceRelease()).isTrue();
then(projectVersion("1.0.1.SR1").isReleaseOrServiceRelease()).isTrue();
//then(projectVersion("1.0.0").isReleaseOrServiceRelease()).isTrue();
//then(projectVersion("1.0.1").isReleaseOrServiceRelease()).isTrue();
}

@Test
Expand All @@ -324,6 +340,11 @@ public void should_return_true_when_versions_are_from_same_minor() {
String thatVersion = "1.3.2.SR3";

then(projectVersion(thisVersion).isSameMinor(thatVersion)).isTrue();

thisVersion = "1.3.1-RC3";
thatVersion = "1.3.2-M2";

then(projectVersion(thisVersion).isSameMinor(thatVersion)).isTrue();
}

@Test
Expand Down Expand Up @@ -575,6 +596,7 @@ public void should_return_no_unacceptable_patterns_for_a_snapshot_version() {
then(projectVersion("1.0.0.BUILD-SNAPSHOT").unacceptableVersionPatterns())
.isEmpty();
then(projectVersion("1.0.0.SNAPSHOT").unacceptableVersionPatterns()).isEmpty();
then(projectVersion("1.0.0-SNAPSHOT").unacceptableVersionPatterns()).isEmpty();
}

@Test
Expand All @@ -589,15 +611,15 @@ public void should_return_snapshot_unacceptable_patterns_for_a_milestone_or_rc_v
then(rcPatterns).isNotEmpty();
then(rcPatterns.get(0).pattern()).contains("SNAPSHOT");

List<Pattern> milestonePatternsWithASlash = projectVersion("1.0.0-M1")
List<Pattern> milestonePatternsWithDash = projectVersion("1.0.0-M1")
.unacceptableVersionPatterns();
then(milestonePatterns).isNotEmpty();
then(milestonePatterns.get(0).pattern()).contains("SNAPSHOT");
then(milestonePatternsWithDash).isNotEmpty();
then(milestonePatternsWithDash.get(0).pattern()).contains("SNAPSHOT");

List<Pattern> rcPatternsWithASlash = projectVersion("1.0.0-RC1")
List<Pattern> rcPatternsWithDash = projectVersion("1.0.0-RC1")
.unacceptableVersionPatterns();
then(rcPatterns).isNotEmpty();
then(rcPatterns.get(0).pattern()).contains("SNAPSHOT");
then(rcPatternsWithDash).isNotEmpty();
then(rcPatternsWithDash.get(0).pattern()).contains("SNAPSHOT");
}

@Test
Expand All @@ -616,9 +638,9 @@ public void should_return_snapshot_milestone_rc_unacceptable_patterns_for_a_ga_o
.unacceptableVersionPatterns();
thenPatternsForSnapshotMilestoneAndReleaseCandidateArePresent(srPatterns);

List<Pattern> srPatternsWithASlash = projectVersion("1.0.0-SR1")
List<Pattern> srPatternsWithDash = projectVersion("1.0.0-SR1")
.unacceptableVersionPatterns();
thenPatternsForSnapshotMilestoneAndReleaseCandidateArePresent(srPatterns);
thenPatternsForSnapshotMilestoneAndReleaseCandidateArePresent(srPatternsWithDash);

List<Pattern> unknownTypeOfVersion = projectVersion("1.0.0.SOMETHING")
.unacceptableVersionPatterns();
Expand Down

0 comments on commit 833ec47

Please sign in to comment.