Skip to content

Commit 17f2598

Browse files
committed
Fix version ordering.
1 parent f7fc523 commit 17f2598

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/main/java/org/springframework/data/release/model/ArtifactVersion.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ public int compareTo(Suffix o) {
551551
if (sv.type.equals("SR")) {
552552
return -1;
553553
}
554+
return 1;
554555
}
555556

556557
return o instanceof Release ? 0 : -1;

src/test/java/org/springframework/data/release/model/ArtifactVersionUnitTests.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ void ordersCorrectly() {
143143
.isGreaterThan(ArtifactVersion.of("1.9.0-M1"));
144144
assertThat(ArtifactVersion.of("1.9.0-M2")).isGreaterThan(ArtifactVersion.of("1.9.0-SNAPSHOT"))
145145
.isLessThan(ArtifactVersion.of("1.9.0-RC1")).isLessThan(ArtifactVersion.of("1.9.0"));
146+
147+
assertThat(ArtifactVersion.of("1.9.0.M1")).isLessThan(ArtifactVersion.of("1.9.0"))
148+
.isLessThan(ArtifactVersion.of("1.9.0.RELEASE")).isLessThan(ArtifactVersion.of("1.9.0-SR1"));
149+
assertThat(ArtifactVersion.of("1.9.0.RELEASE")).isGreaterThan(ArtifactVersion.of("1.9.0.M1"));
146150
}
147151

148152
@Test
@@ -152,4 +156,5 @@ void returnsCorrectBugfixVersions() {
152156
assertThat(ArtifactVersion.of("1.0.0-M1").getNextBugfixVersion()).isEqualTo(ArtifactVersion.of("1.0.0-SNAPSHOT"));
153157
assertThat(ArtifactVersion.of("1.0.1").getNextBugfixVersion()).isEqualTo(ArtifactVersion.of("1.0.2-SNAPSHOT"));
154158
}
159+
155160
}

0 commit comments

Comments
 (0)