DATACMNS-496 - Version.parse(…) now drops non-numeric artifacts.

Version parsing failed when given version contained non-numeric parts (like 2.0.0-rc1). We now strip everything after the first non numeric part to create a logical version equivalent of the source String.

Original pull request: #81.
This commit is contained in:
Christoph Strobl
2014-04-29 15:41:49 +02:00
committed by Oliver Gierke
parent ec49499e50
commit 57271baf54
2 changed files with 9 additions and 1 deletions

View File

@@ -123,4 +123,12 @@ public class VersionUnitTests {
assertThat(new Version(2, 0, 1, 0).toString(), is("2.0.1"));
assertThat(new Version(2, 0, 0, 1).toString(), is("2.0.0.1"));
}
/**
* @see DATACMNS-496
*/
@Test
public void parseShouldRemoveNonNumericVersionParts() {
assertThat(Version.parse("2.0.0-rc1"), is(new Version(2, 0, 0)));
}
}