Sort members.

This commit is contained in:
Gary Gregory 2021-03-28 08:45:13 -04:00
parent 79eb89e351
commit 5e5af7a02b
1 changed files with 182 additions and 182 deletions

View File

@ -348,175 +348,6 @@ public class SystemUtilsTest {
}
}
@Test
public void testJavaVersionMatches() {
String javaVersion = null;
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.0";
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.1";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.2";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.3.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.3.1";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.4.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.4.1";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.4.2";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.5.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.6.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.7.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.8.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "9";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
}
@Test
public void testIsJavaVersionAtLeast() {
if (SystemUtils.IS_JAVA_1_8) {
@ -695,6 +526,188 @@ public class SystemUtilsTest {
}
}
@Test
public void testJavaAwtHeadless() {
final String expectedStringValue = System.getProperty("java.awt.headless");
final String expectedStringValueWithDefault = System.getProperty("java.awt.headless", "false");
assertNotNull(expectedStringValueWithDefault);
final boolean expectedValue = Boolean.valueOf(expectedStringValue).booleanValue();
if (expectedStringValue != null) {
assertEquals(expectedStringValue, SystemUtils.JAVA_AWT_HEADLESS);
}
assertEquals(expectedValue, SystemUtils.isJavaAwtHeadless());
assertEquals(expectedStringValueWithDefault, "" + SystemUtils.isJavaAwtHeadless());
}
@Test
public void testJavaVersionMatches() {
String javaVersion = null;
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.0";
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.1";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.2";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.3.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.3.1";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.4.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.4.1";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.4.2";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.5.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.6.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.7.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "1.8.0";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
javaVersion = "9";
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.0"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.1"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.2"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.3"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.4"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.5"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.6"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.7"));
assertFalse(SystemUtils.isJavaVersionMatch(javaVersion, "1.8"));
assertTrue(SystemUtils.isJavaVersionMatch(javaVersion, "9"));
}
@Test
public void testOSMatchesName() {
String osName = null;
@ -772,17 +785,4 @@ public class SystemUtilsTest {
assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.10"));
assertTrue(SystemUtils.isOSVersionMatch(osVersion, "10.10.1"));
}
@Test
public void testJavaAwtHeadless() {
final String expectedStringValue = System.getProperty("java.awt.headless");
final String expectedStringValueWithDefault = System.getProperty("java.awt.headless", "false");
assertNotNull(expectedStringValueWithDefault);
final boolean expectedValue = Boolean.valueOf(expectedStringValue).booleanValue();
if (expectedStringValue != null) {
assertEquals(expectedStringValue, SystemUtils.JAVA_AWT_HEADLESS);
}
assertEquals(expectedValue, SystemUtils.isJavaAwtHeadless());
assertEquals(expectedStringValueWithDefault, "" + SystemUtils.isJavaAwtHeadless());
}
}