Commit bbb6b1fa authored by Guus der Kinderen's avatar Guus der Kinderen Committed by daryl herzmann

OF-1351: Allow for numbered releases (#826)

parent 51100ccb
...@@ -133,7 +133,7 @@ public final class Version implements Comparable<Version> { ...@@ -133,7 +133,7 @@ public final class Version implements Comparable<Version> {
if (versionString == null) { if (versionString == null) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(major).append('.').append(minor).append('.').append(micro); sb.append(major).append('.').append(minor).append('.').append(micro);
if (status != ReleaseStatus.Release) { if (status != ReleaseStatus.Release || statusVersion != -1) {
sb.append(' ').append(status); sb.append(' ').append(status);
if (statusVersion >= 0) { if (statusVersion >= 0) {
sb.append(' ').append(statusVersion); sb.append(' ').append(statusVersion);
...@@ -196,7 +196,7 @@ public final class Version implements Comparable<Version> { ...@@ -196,7 +196,7 @@ public final class Version implements Comparable<Version> {
* are indicated by type safe enum constants. * are indicated by type safe enum constants.
*/ */
public enum ReleaseStatus { public enum ReleaseStatus {
Release(""), Release_Candidate("RC"), Beta("Beta"), Alpha("Alpha"); Release("Release"), Release_Candidate("RC"), Beta("Beta"), Alpha("Alpha");
private String status; private String status;
......
...@@ -37,6 +37,20 @@ public class VersionTest { ...@@ -37,6 +37,20 @@ public class VersionTest {
assertEquals("1.2.3 Beta 3", test.getVersionString()); assertEquals("1.2.3 Beta 3", test.getVersionString());
} }
@Test
public void testVersionWithRegularStringConstructorB() {
Version test = new Version("1.2.3 Release 3");
assertEquals(1, test.getMajor());
assertEquals(2, test.getMinor());
assertEquals(3, test.getMicro());
assertEquals(ReleaseStatus.Release, test.getStatus());
assertEquals(3, test.getStatusVersion());
assertEquals("1.2.3 Release 3", test.getVersionString());
}
@Test @Test
public void testVersionWithNullStringConstructor() { public void testVersionWithNullStringConstructor() {
Version test = new Version(null); Version test = new Version(null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment