Use SystemProperties instead of magic strings
diff --git a/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java b/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
index e28cf1a..5738624 100644
--- a/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
+++ b/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
@@ -43,6 +43,7 @@
import java.util.Map;
import org.apache.commons.exec.environment.EnvironmentUtils;
+import org.apache.commons.lang3.SystemProperties;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
@@ -456,7 +457,7 @@
void testExecuteWatchdogSync() throws Exception {
if (OS.isFamilyOpenVms()) {
- System.out.println("The test 'testExecuteWatchdogSync' currently hangs on the following OS : " + System.getProperty("os.name"));
+ System.out.println("The test 'testExecuteWatchdogSync' currently hangs on the following OS : " + SystemProperties.getOsName());
return;
}
diff --git a/src/test/java/org/apache/commons/exec/issues/Exec36Test.java b/src/test/java/org/apache/commons/exec/issues/Exec36Test.java
index 543f666..25ca498 100644
--- a/src/test/java/org/apache/commons/exec/issues/Exec36Test.java
+++ b/src/test/java/org/apache/commons/exec/issues/Exec36Test.java
@@ -33,6 +33,7 @@
import org.apache.commons.exec.OS;
import org.apache.commons.exec.PumpStreamHandler;
import org.apache.commons.exec.TestUtil;
+import org.apache.commons.lang3.SystemProperties;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
@@ -174,7 +175,7 @@
} else if (OS.isFamilyUnix()) {
expected = "dotnetfx.exe\n" + "/q:a\n" + "/c:\"install.exe /l \"\"/Documents and Settings/myusername/Local Settings/Temp/netfx.log\"\" /q\"";
} else {
- System.err.println("The test 'testExec36_3' does not support the following OS : " + System.getProperty("os.name"));
+ System.err.println("The test 'testExec36_3' does not support the following OS : " + SystemProperties.getOsName());
return;
}
diff --git a/src/test/java/org/apache/commons/exec/issues/Exec41Test.java b/src/test/java/org/apache/commons/exec/issues/Exec41Test.java
index 22e705c..7f50ec2 100644
--- a/src/test/java/org/apache/commons/exec/issues/Exec41Test.java
+++ b/src/test/java/org/apache/commons/exec/issues/Exec41Test.java
@@ -30,6 +30,7 @@
import org.apache.commons.exec.OS;
import org.apache.commons.exec.PumpStreamHandler;
import org.apache.commons.exec.TestUtil;
+import org.apache.commons.lang3.SystemProperties;
import org.junit.jupiter.api.Test;
/**
@@ -98,13 +99,13 @@
if (OS.isFamilyWindows()) {
cmdLine = CommandLine.parse("ping.exe -n 10 -w 1000 127.0.0.1");
- } else if ("HP-UX".equals(System.getProperty("os.name"))) {
+ } else if ("HP-UX".equals(SystemProperties.getOsName())) {
// see EXEC-52 - option must appear after the hostname!
cmdLine = CommandLine.parse("ping 127.0.0.1 -n 10");
} else if (OS.isFamilyUnix()) {
cmdLine = CommandLine.parse("ping -c 10 127.0.0.1");
} else {
- System.err.println("The test 'testExec41WithStreams' does not support the following OS : " + System.getProperty("os.name"));
+ System.err.println("The test 'testExec41WithStreams' does not support the following OS : " + SystemProperties.getOsName());
return;
}