bael-4909: update test case
This commit is contained in:
parent
9a2b779e5f
commit
3cb6624aa6
|
@ -18,15 +18,14 @@ public class VersionUnitTest {
|
|||
@Test
|
||||
@Disabled("Only valid for Java 8 and lower")
|
||||
public void givenJava_whenUsingCommonsLang_thenGetVersion() {
|
||||
String expectedVersion = "8";
|
||||
String version = SystemUtils.JAVA_SPECIFICATION_VERSION;
|
||||
if (version.startsWith("1.")) {
|
||||
version = version.substring(2, 3);
|
||||
int expectedVersion = 8;
|
||||
String[] versionElements = SystemUtils.JAVA_SPECIFICATION_VERSION.split("\\.");
|
||||
int discard = Integer.parseInt(versionElements[0]);
|
||||
int version;
|
||||
if (discard == 1) {
|
||||
version = Integer.parseInt(versionElements[1]);
|
||||
} else {
|
||||
int separator = version.indexOf(".");
|
||||
if (separator != -1) {
|
||||
version = version.substring(0, separator);
|
||||
}
|
||||
version = discard;
|
||||
}
|
||||
Assertions.assertThat(version).isEqualTo(expectedVersion);
|
||||
}
|
||||
|
@ -34,15 +33,14 @@ public class VersionUnitTest {
|
|||
@Test
|
||||
@Disabled("Only valid for Java 8 and lower")
|
||||
public void givenJava_whenUsingSystemProp_thenGetVersion() {
|
||||
String expectedVersion = "8";
|
||||
String version = System.getProperty("java.version");
|
||||
if (version.startsWith("1.")) {
|
||||
version = version.substring(2, 3);
|
||||
int expectedVersion = 8;
|
||||
String[] versionElements = System.getProperty("java.version").split("\\.");
|
||||
int discard = Integer.parseInt(versionElements[0]);
|
||||
int version;
|
||||
if (discard == 1) {
|
||||
version = Integer.parseInt(versionElements[1]);
|
||||
} else {
|
||||
int separator = version.indexOf(".");
|
||||
if (separator != -1) {
|
||||
version = version.substring(0, separator);
|
||||
}
|
||||
version = discard;
|
||||
}
|
||||
Assertions.assertThat(version).isEqualTo(expectedVersion);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue