This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-exec.git
The following commit(s) were added to refs/heads/master by this push: new d75a5c51 Use JUnit 5 convention for test method visibility d75a5c51 is described below commit d75a5c51f78fa2ead4ce0b903d8840a598a7c8fc Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sat Jun 7 15:22:21 2025 -0400 Use JUnit 5 convention for test method visibility --- .../org/apache/commons/exec/CommandLineTest.java | 68 +++++++++++----------- .../apache/commons/exec/DefaultExecutorTest.java | 64 ++++++++++---------- .../apache/commons/exec/LogOutputStreamTest.java | 4 +- src/test/java/org/apache/commons/exec/OSTest.java | 6 +- .../apache/commons/exec/PumpStreamHandlerTest.java | 2 +- .../org/apache/commons/exec/StandAloneTest.java | 10 ++-- .../apache/commons/exec/TimeoutObserverTest.java | 4 +- .../java/org/apache/commons/exec/TutorialTest.java | 2 +- .../exec/environment/EnvironmentUtilsTest.java | 12 ++-- .../org/apache/commons/exec/issues/Exec33Test.java | 2 +- .../org/apache/commons/exec/issues/Exec34Test.java | 4 +- .../org/apache/commons/exec/issues/Exec36Test.java | 10 ++-- .../org/apache/commons/exec/issues/Exec41Test.java | 4 +- .../org/apache/commons/exec/issues/Exec44Test.java | 2 +- .../org/apache/commons/exec/issues/Exec49Test.java | 4 +- .../org/apache/commons/exec/issues/Exec57Test.java | 4 +- .../org/apache/commons/exec/issues/Exec60Test.java | 2 +- .../org/apache/commons/exec/issues/Exec62Test.java | 2 +- .../org/apache/commons/exec/issues/Exec65Test.java | 8 +-- .../exec/launcher/AbstractCommandLauncherTest.java | 4 +- .../exec/launcher/CommandLauncherFactoryTest.java | 2 +- .../exec/launcher/VmsCommandLauncherTest.java | 6 +- .../org/apache/commons/exec/util/MapUtilTest.java | 6 +- .../apache/commons/exec/util/StringUtilTest.java | 8 +-- 24 files changed, 120 insertions(+), 120 deletions(-) diff --git a/src/test/java/org/apache/commons/exec/CommandLineTest.java b/src/test/java/org/apache/commons/exec/CommandLineTest.java index 939a3a64..bd65231b 100644 --- a/src/test/java/org/apache/commons/exec/CommandLineTest.java +++ b/src/test/java/org/apache/commons/exec/CommandLineTest.java @@ -37,7 +37,7 @@ import org.junit.jupiter.api.Test; public class CommandLineTest { @Test - public void testAddArgument() { + void testAddArgument() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArgument("foo"); cmdl.addArgument("bar"); @@ -46,7 +46,7 @@ public class CommandLineTest { } @Test - public void testAddArguments() { + void testAddArguments() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArguments("foo bar"); assertEquals("[test, foo, bar]", cmdl.toString()); @@ -54,7 +54,7 @@ public class CommandLineTest { } @Test - public void testAddArgumentsArray() { + void testAddArgumentsArray() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArguments(new String[] { "foo", "bar" }); assertEquals("[test, foo, bar]", cmdl.toString()); @@ -62,7 +62,7 @@ public class CommandLineTest { } @Test - public void testAddArgumentsArrayNull() { + void testAddArgumentsArrayNull() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArguments((String[]) null); assertEquals("[test]", cmdl.toString()); @@ -70,7 +70,7 @@ public class CommandLineTest { } @Test - public void testAddArgumentsWithQuotes() { + void testAddArgumentsWithQuotes() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArguments("'foo' \"bar\""); assertEquals("[test, foo, bar]", cmdl.toString()); @@ -78,7 +78,7 @@ public class CommandLineTest { } @Test - public void testAddArgumentsWithQuotesAndSpaces() { + void testAddArgumentsWithQuotesAndSpaces() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArguments("'fo o' \"ba r\""); assertEquals("[test, \"fo o\", \"ba r\"]", cmdl.toString()); @@ -86,13 +86,13 @@ public class CommandLineTest { } @Test - public void testAddArgumentWithBothQuotes() { + void testAddArgumentWithBothQuotes() { final CommandLine cmdl = new CommandLine("test"); assertThrows(IllegalArgumentException.class, () -> cmdl.addArgument("b\"a'r")); } @Test - public void testAddArgumentWithQuote() { + void testAddArgumentWithQuote() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArgument("foo"); cmdl.addArgument("ba\"r"); @@ -101,7 +101,7 @@ public class CommandLineTest { } @Test - public void testAddArgumentWithQuotesAround() { + void testAddArgumentWithQuotesAround() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArgument("\'foo\'"); cmdl.addArgument("\"bar\""); @@ -111,7 +111,7 @@ public class CommandLineTest { } @Test - public void testAddArgumentWithSingleQuote() { + void testAddArgumentWithSingleQuote() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArgument("foo"); @@ -121,7 +121,7 @@ public class CommandLineTest { } @Test - public void testAddArgumentWithSpace() { + void testAddArgumentWithSpace() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArgument("foo"); cmdl.addArgument("ba r"); @@ -130,7 +130,7 @@ public class CommandLineTest { } @Test - public void testAddNullArgument() { + void testAddNullArgument() { final CommandLine cmdl = new CommandLine("test"); cmdl.addArgument(null); @@ -142,7 +142,7 @@ public class CommandLineTest { * A little example how to add two command line arguments in one line, e.g. to make commenting out some options less error prone. */ @Test - public void testAddTwoArguments() { + void testAddTwoArguments() { final CommandLine userAddCL1 = new CommandLine("useradd"); userAddCL1.addArgument("-g"); @@ -160,7 +160,7 @@ public class CommandLineTest { * Test expanding the command line based on a user-supplied map. */ @Test - public void testCommandLineParsingWithExpansion1() { + void testCommandLineParsingWithExpansion1() { CommandLine cmdl; @@ -205,7 +205,7 @@ public class CommandLineTest { * times. */ @Test - public void testCommandLineParsingWithExpansion2() { + void testCommandLineParsingWithExpansion2() { CommandLine cmdl; String[] result; @@ -253,7 +253,7 @@ public class CommandLineTest { } @Test - public void testCommandLineParsingWithExpansion3() { + void testCommandLineParsingWithExpansion3() { final CommandLine cmdl = CommandLine.parse("AcroRd32.exe"); cmdl.addArgument("/p"); cmdl.addArgument("/h"); @@ -274,7 +274,7 @@ public class CommandLineTest { * "\"-XX:ParallelGCThreads=2\"" */ @Test - public void testComplexAddArgument() { + void testComplexAddArgument() { final CommandLine cmdl = new CommandLine("runMemorySud.cmd"); cmdl.addArgument("10", false); cmdl.addArgument("30", false); @@ -288,7 +288,7 @@ public class CommandLineTest { * "\"-XX:ParallelGCThreads=2\"" */ @Test - public void testComplexAddArguments1() { + void testComplexAddArguments1() { final CommandLine cmdl = new CommandLine("runMemorySud.cmd"); cmdl.addArguments(new String[] { "10", "30", "-XX:+UseParallelGC", "\"-XX:ParallelGCThreads=2\"" }, false); assertArrayEquals(new String[] { "runMemorySud.cmd", "10", "30", "-XX:+UseParallelGC", "\"-XX:ParallelGCThreads=2\"" }, cmdl.toStrings()); @@ -300,14 +300,14 @@ public class CommandLineTest { * feature. */ @Test - public void testComplexAddArguments2() { + void testComplexAddArguments2() { final CommandLine cmdl = new CommandLine("runMemorySud.cmd"); cmdl.addArguments("10 30 -XX:+UseParallelGC '\"-XX:ParallelGCThreads=2\"'", false); assertArrayEquals(new String[] { "runMemorySud.cmd", "10", "30", "-XX:+UseParallelGC", "\"-XX:ParallelGCThreads=2\"" }, cmdl.toStrings()); } @Test - public void testCopyConstructor() { + void testCopyConstructor() { final Map<String, String> map = new HashMap<>(); map.put("bar", "bar"); final CommandLine other = new CommandLine("test"); @@ -323,7 +323,7 @@ public class CommandLineTest { } @Test - public void testExecutable() { + void testExecutable() { final CommandLine cmdl = new CommandLine("test"); assertEquals("[test]", cmdl.toString()); assertArrayEquals(new String[] { "test" }, cmdl.toStrings()); @@ -332,46 +332,46 @@ public class CommandLineTest { } @Test - public void testExecutableWhitespaceString() { + void testExecutableWhitespaceString() { assertThrows(IllegalArgumentException.class, () -> new CommandLine(" ")); } @Test - public void testExecutableZeroLengthString() { + void testExecutableZeroLengthString() { assertThrows(IllegalArgumentException.class, () -> new CommandLine("")); } @Test - public void testNullExecutable() { + void testNullExecutable() { assertThrows(NullPointerException.class, () -> new CommandLine((String) null)); } @Test - public void testParseCommandLine() { + void testParseCommandLine() { final CommandLine cmdl = CommandLine.parse("test foo bar"); assertEquals("[test, foo, bar]", cmdl.toString()); assertArrayEquals(new String[] { "test", "foo", "bar" }, cmdl.toStrings()); } @Test - public void testParseCommandLineWithNull() { + void testParseCommandLineWithNull() { assertThrows(IllegalArgumentException.class, () -> CommandLine.parse(null)); } @Test - public void testParseCommandLineWithOnlyWhitespace() { + void testParseCommandLineWithOnlyWhitespace() { assertThrows(IllegalArgumentException.class, () -> CommandLine.parse(" ")); } @Test - public void testParseCommandLineWithQuotes() { + void testParseCommandLineWithQuotes() { final CommandLine cmdl = CommandLine.parse("test \"foo\" \'ba r\'"); assertEquals("[test, foo, \"ba r\"]", cmdl.toString()); assertArrayEquals(new String[] { "test", "foo", "\"ba r\"" }, cmdl.toStrings()); } @Test - public void testParseCommandLineWithUnevenQuotes() { + void testParseCommandLineWithUnevenQuotes() { assertThrows(IllegalArgumentException.class, () -> CommandLine.parse("test \"foo bar"), "IllegalArgumentException must be thrown due to uneven quotes"); } @@ -380,7 +380,7 @@ public class CommandLineTest { * without adding a space, e.g. "500x> ". */ @Test - public void testParseComplexCommandLine1() { + void testParseComplexCommandLine1() { final Map<String, String> substitutionMap = new HashMap<>(); substitutionMap.put("in", "source.jpg"); substitutionMap.put("out", "target.jpg"); @@ -392,7 +392,7 @@ public class CommandLineTest { * Another command line parsing puzzle from Kai Hu - as far as I understand it there is no way to express that in a one-line command string. */ @Test - public void testParseComplexCommandLine2() { + void testParseComplexCommandLine2() { final String commandLine = "./script/jrake cruise:publish_installers " + "INSTALLER_VERSION=unstable_2_1 " + "INSTALLER_PATH=\"/var/lib/ cruise-agent/installers\" " + "INSTALLER_DOWNLOAD_SERVER=\'something\' " + "WITHOUT_HELP_DOC=true"; final CommandLine cmdl = CommandLine.parse(commandLine); @@ -410,7 +410,7 @@ public class CommandLineTest { * cmd.exe /C c:\was51\Web Sphere\AppServer\bin\versionInfo.bat */ @Test - public void testParseRealLifeCommandLine() { + void testParseRealLifeCommandLine() { final String commandLine = "cmd.exe /C \"c:\\was51\\Web Sphere\\AppServer\\bin\\versionInfo.bat\""; @@ -426,7 +426,7 @@ public class CommandLineTest { * @throws Exception the test failed */ @Test - public void testToString() throws Exception { + void testToString() throws Exception { CommandLine cmdl; final Map<String, String> params = new HashMap<>(); @@ -451,7 +451,7 @@ public class CommandLineTest { * @throws Exception the test failed */ @Test - public void testToStringTroubleshooting() throws Exception { + void testToStringTroubleshooting() throws Exception { System.out.println("testToStringTroubleshooting"); // On HP-UX quotes handling leads to errors, // also usage of quotes isn't mandatory on other platforms too diff --git a/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java b/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java index 269e28d7..24f08132 100644 --- a/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java +++ b/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java @@ -98,7 +98,7 @@ public class DefaultExecutorTest { */ @Test @Disabled - public void testExecuteStability() throws Exception { + void testExecuteStability() throws Exception { // make a plain-vanilla test for (int i = 0; i < 100; i++) { @@ -172,7 +172,7 @@ public class DefaultExecutorTest { } @Test - public void testAddEnvironmentVariableEmbeddedQuote() throws Exception { + void testAddEnvironmentVariableEmbeddedQuote() throws Exception { final Map<String, String> myEnvVars = new HashMap<>(EnvironmentUtils.getProcEnvironment()); final String name = "NEW_VAR"; final String value = "NEW_\"_VAL"; @@ -189,7 +189,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testAddEnvironmentVariables() throws Exception { + void testAddEnvironmentVariables() throws Exception { final Map<String, String> myEnvVars = new HashMap<>(EnvironmentUtils.getProcEnvironment()); myEnvVars.put("NEW_VAR", "NEW_VAL"); exec.execute(new CommandLine(environmentSript), myEnvVars); @@ -204,7 +204,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testEnvironmentVariables() throws Exception { + void testEnvironmentVariables() throws Exception { exec.execute(new CommandLine(environmentSript)); final String environment = baos.toString().trim(); assertFalse(environment.isEmpty(), "Found no environment variables"); @@ -217,7 +217,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecute() throws Exception { + void testExecute() throws Exception { final CommandLine cl = new CommandLine(testScript); final int exitValue = exec.execute(cl); assertEquals("FOO..", baos.toString().trim()); @@ -232,7 +232,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteAsync() throws Exception { + void testExecuteAsync() throws Exception { final CommandLine cl = new CommandLine(testScript); final DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); exec.execute(cl, resultHandler); @@ -247,7 +247,7 @@ public class DefaultExecutorTest { * Try to start an non-existing application where the exception is caught/processed by the result handler. */ @Test - public void testExecuteAsyncNonExistingApplication() throws Exception { + void testExecuteAsyncNonExistingApplication() throws Exception { final CommandLine cl = new CommandLine(nonExistingTestScript); final DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); final DefaultExecutor executor = DefaultExecutor.builder().get(); @@ -266,7 +266,7 @@ public class DefaultExecutorTest { * @see <a href="https://issues.apache.org/jira/browse/EXEC-71">EXEC-71</a> */ @Test - public void testExecuteAsyncNonExistingApplicationWithWatchdog() throws Exception { + void testExecuteAsyncNonExistingApplicationWithWatchdog() throws Exception { final CommandLine cl = new CommandLine(nonExistingTestScript); final DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler() { @Override @@ -294,7 +294,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteAsyncWithError() throws Exception { + void testExecuteAsyncWithError() throws Exception { final CommandLine cl = new CommandLine(errorTestScript); final DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); exec.execute(cl, resultHandler); @@ -312,7 +312,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteAsyncWithProcessDestroyer() throws Exception { + void testExecuteAsyncWithProcessDestroyer() throws Exception { final CommandLine cl = new CommandLine(foreverTestScript); final DefaultExecuteResultHandler handler = new DefaultExecuteResultHandler(); @@ -351,7 +351,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteAsyncWithTimelyUserTermination() throws Exception { + void testExecuteAsyncWithTimelyUserTermination() throws Exception { final CommandLine cl = new CommandLine(foreverTestScript); final ExecuteWatchdog watchdog = new ExecuteWatchdog(Integer.MAX_VALUE); exec.setWatchdog(watchdog); @@ -377,7 +377,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteAsyncWithTooLateUserTermination() throws Exception { + void testExecuteAsyncWithTooLateUserTermination() throws Exception { final CommandLine cl = new CommandLine(foreverTestScript); final DefaultExecuteResultHandler handler = new DefaultExecuteResultHandler(); final ExecuteWatchdog watchdog = new ExecuteWatchdog(3000); @@ -399,7 +399,7 @@ public class DefaultExecutorTest { * Try to start an non-existing application which should result in an exception. */ @Test - public void testExecuteNonExistingApplication() throws Exception { + void testExecuteNonExistingApplication() throws Exception { final CommandLine cl = new CommandLine(nonExistingTestScript); final DefaultExecutor executor = DefaultExecutor.builder().get(); @@ -410,7 +410,7 @@ public class DefaultExecutorTest { * Try to start an non-existing application which should result in an exception. */ @Test - public void testExecuteNonExistingApplicationWithWatchDog() throws Exception { + void testExecuteNonExistingApplicationWithWatchDog() throws Exception { final CommandLine cl = new CommandLine(nonExistingTestScript); final DefaultExecutor executor = DefaultExecutor.builder().get(); executor.setWatchdog(new ExecuteWatchdog(ExecuteWatchdog.INFINITE_TIMEOUT)); @@ -425,7 +425,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWatchdogAsync() throws Exception { + void testExecuteWatchdogAsync() throws Exception { final long timeout = 10000; @@ -453,7 +453,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWatchdogSync() throws Exception { + void testExecuteWatchdogSync() throws Exception { if (OS.isFamilyOpenVms()) { System.out.println("The test 'testExecuteWatchdogSync' currently hangs on the following OS : " + System.getProperty("os.name")); @@ -491,7 +491,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWatchdogVeryLongTimeout() throws Exception { + void testExecuteWatchdogVeryLongTimeout() throws Exception { final long timeout = Long.MAX_VALUE; final CommandLine cl = new CommandLine(testScript); @@ -510,7 +510,7 @@ public class DefaultExecutorTest { } @Test - public void testExecuteWithArg() throws Exception { + void testExecuteWithArg() throws Exception { final CommandLine cl = new CommandLine(testScript); cl.addArgument("BAR"); final int exitValue = exec.execute(cl); @@ -525,7 +525,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWithComplexArguments() throws Exception { + void testExecuteWithComplexArguments() throws Exception { final CommandLine cl = new CommandLine(printArgsScript); cl.addArgument("gdal_translate"); cl.addArgument("HDF5:\"/home/kk/grass/data/4404.he5\"://HDFEOS/GRIDS/OMI_Column_Amount_O3/Data_Fields/ColumnAmountO3/home/kk/4.tif", false); @@ -540,7 +540,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWithCustomExitValue1() throws Exception { + void testExecuteWithCustomExitValue1() throws Exception { exec.setExitValue(errorStatus); final CommandLine cl = new CommandLine(errorTestScript); exec.execute(cl); @@ -552,7 +552,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWithCustomExitValue2() throws Exception { + void testExecuteWithCustomExitValue2() throws Exception { final CommandLine cl = new CommandLine(errorTestScript); exec.setExitValue(successStatus); try { @@ -564,7 +564,7 @@ public class DefaultExecutorTest { } @Test - public void testExecuteWithError() throws Exception { + void testExecuteWithError() throws Exception { final CommandLine cl = new CommandLine(errorTestScript); try { @@ -581,7 +581,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWithFancyArg() throws Exception { + void testExecuteWithFancyArg() throws Exception { final CommandLine cl = new CommandLine(testScript); cl.addArgument("test $;`(0)[1]{2}"); final int exitValue = exec.execute(cl); @@ -590,7 +590,7 @@ public class DefaultExecutorTest { } @Test - public void testExecuteWithInvalidWorkingDirectory() throws Exception { + void testExecuteWithInvalidWorkingDirectory() throws Exception { final File workingDir = new File("/foo/bar"); final CommandLine cl = new CommandLine(testScript); exec.setWorkingDirectory(workingDir); @@ -604,7 +604,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWithNullOutErr() throws Exception { + void testExecuteWithNullOutErr() throws Exception { final CommandLine cl = new CommandLine(testScript); final PumpStreamHandler pumpStreamHandler = new PumpStreamHandler(null, null); final DefaultExecutor executor = DefaultExecutor.builder().get(); @@ -619,7 +619,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWithProcessDestroyer() throws Exception { + void testExecuteWithProcessDestroyer() throws Exception { final CommandLine cl = new CommandLine(testScript); final ShutdownHookProcessDestroyer processDestroyer = new ShutdownHookProcessDestroyer(); @@ -644,7 +644,7 @@ public class DefaultExecutorTest { */ @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) - public void testExecuteWithRedirectedStreams() throws Exception { + void testExecuteWithRedirectedStreams() throws Exception { final int exitValue; try (FileInputStream fis = new FileInputStream("./NOTICE.txt")) { final CommandLine cl = new CommandLine(redirectScript); @@ -665,7 +665,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWithRedirectOutErr() throws Exception { + void testExecuteWithRedirectOutErr() throws Exception { final Path outFile = Files.createTempFile("EXEC", ".test"); final CommandLine cl = new CommandLine(testScript); try (OutputStream outAndErr = Files.newOutputStream(outFile)) { @@ -684,7 +684,7 @@ public class DefaultExecutorTest { * Execute the test script and pass a environment containing 'TEST_ENV_VAR'. */ @Test - public void testExecuteWithSingleEnvironmentVariable() throws Exception { + void testExecuteWithSingleEnvironmentVariable() throws Exception { final Map<String, String> env = new HashMap<>(); env.put("TEST_ENV_VAR", "XYZ"); @@ -706,7 +706,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testExecuteWithStdOutErr() throws Exception { + void testExecuteWithStdOutErr() throws Exception { final CommandLine cl = new CommandLine(testScript); final PumpStreamHandler pumpStreamHandler = new PumpStreamHandler(System.out, System.err); final DefaultExecutor executor = DefaultExecutor.builder().get(); @@ -720,7 +720,7 @@ public class DefaultExecutorTest { // ====================================================================== @Test - public void testExecuteWithWorkingDirectory() throws Exception { + void testExecuteWithWorkingDirectory() throws Exception { final Path workingDirPath = Paths.get("./target"); final CommandLine cl = new CommandLine(testScript); final File workingDirFile = workingDirPath.toFile(); @@ -739,7 +739,7 @@ public class DefaultExecutorTest { * @throws Exception the test failed */ @Test - public void testStdInHandling() throws Exception { + void testStdInHandling() throws Exception { // newline not needed; causes problems for VMS final ByteArrayInputStream bais = new ByteArrayInputStream("Foo".getBytes()); final CommandLine cl = new CommandLine(this.stdinSript); diff --git a/src/test/java/org/apache/commons/exec/LogOutputStreamTest.java b/src/test/java/org/apache/commons/exec/LogOutputStreamTest.java index bfa2c3ad..4b9171f0 100644 --- a/src/test/java/org/apache/commons/exec/LogOutputStreamTest.java +++ b/src/test/java/org/apache/commons/exec/LogOutputStreamTest.java @@ -79,7 +79,7 @@ public class LogOutputStreamTest { } @Test - public void testStdout() throws Exception { + void testStdout() throws Exception { this.systemOut = new SystemLogOutputStream(1); this.exec.setStreamHandler(new PumpStreamHandler(systemOut, systemOut)); @@ -90,7 +90,7 @@ public class LogOutputStreamTest { @Test @Disabled("The file utf8CharacterScript is missing from the repository and is not in its history") - public void testStdoutWithUTF8Characters() throws Exception { + void testStdoutWithUTF8Characters() throws Exception { this.systemOut = new SystemLogOutputStream(1, StandardCharsets.UTF_8); this.exec.setStreamHandler(new PumpStreamHandler(systemOut, systemOut)); diff --git a/src/test/java/org/apache/commons/exec/OSTest.java b/src/test/java/org/apache/commons/exec/OSTest.java index a74064de..a9043d55 100644 --- a/src/test/java/org/apache/commons/exec/OSTest.java +++ b/src/test/java/org/apache/commons/exec/OSTest.java @@ -31,14 +31,14 @@ import org.junit.jupiter.api.condition.EnabledOnOs; public class OSTest { @Test - public void testIsArch() { + void testIsArch() { assertFalse(OS.isArch(null)); assertFalse(OS.isArch("....")); } @Test @EnabledOnOs(org.junit.jupiter.api.condition.OS.MAC) - public void testIsArchMacOs() { + void testIsArchMacOs() { assertFalse(OS.isFamilyDOS()); assertTrue(OS.isFamilyMac()); assertFalse(OS.isFamilyNetware()); @@ -54,7 +54,7 @@ public class OSTest { } @Test - public void testIsVersion() { + void testIsVersion() { assertFalse(OS.isVersion(null)); assertFalse(OS.isVersion("....")); } diff --git a/src/test/java/org/apache/commons/exec/PumpStreamHandlerTest.java b/src/test/java/org/apache/commons/exec/PumpStreamHandlerTest.java index b1f8b50a..e122d7b7 100644 --- a/src/test/java/org/apache/commons/exec/PumpStreamHandlerTest.java +++ b/src/test/java/org/apache/commons/exec/PumpStreamHandlerTest.java @@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test; public class PumpStreamHandlerTest { @Test - public void testSetStopTimeout() { + void testSetStopTimeout() { final PumpStreamHandler handler = new PumpStreamHandler(); assertEquals(Duration.ZERO, handler.getStopTimeout()); handler.setStopTimeout(Duration.ofMinutes(1)); diff --git a/src/test/java/org/apache/commons/exec/StandAloneTest.java b/src/test/java/org/apache/commons/exec/StandAloneTest.java index 46834071..a0c7209e 100644 --- a/src/test/java/org/apache/commons/exec/StandAloneTest.java +++ b/src/test/java/org/apache/commons/exec/StandAloneTest.java @@ -39,7 +39,7 @@ public class StandAloneTest { @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) - public void testDefaultExecutorBuilderFromFile() throws Exception { + void testDefaultExecutorBuilderFromFile() throws Exception { final Path testScript = TestUtil.resolveScriptPathForOS("./src/test/scripts/standalone"); // @formatter:off final Executor exec = DefaultExecutor.builder() @@ -56,7 +56,7 @@ public class StandAloneTest { @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) - public void testDefaultExecutorBuilderFromPath() throws Exception { + void testDefaultExecutorBuilderFromPath() throws Exception { final Path testScript = TestUtil.resolveScriptPathForOS("./src/test/scripts/standalone"); // @formatter:off final Executor exec = DefaultExecutor.builder() @@ -73,7 +73,7 @@ public class StandAloneTest { @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) - public void testDefaultExecutorDefaultBuilder() throws Exception { + void testDefaultExecutorDefaultBuilder() throws Exception { final Path testScript = TestUtil.resolveScriptPathForOS("./src/test/scripts/standalone"); final Executor exec = DefaultExecutor.builder().get(); exec.setStreamHandler(new PumpStreamHandler()); @@ -84,7 +84,7 @@ public class StandAloneTest { @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) - public void testDefaultExecutorFromFile() throws Exception { + void testDefaultExecutorFromFile() throws Exception { final Path testScript = TestUtil.resolveScriptPathForOS("./src/test/scripts/standalone"); final Executor exec = new DefaultExecutor(); exec.setStreamHandler(new PumpStreamHandler()); @@ -95,7 +95,7 @@ public class StandAloneTest { @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) - public void testDefaultExecutorFromPath() throws Exception { + void testDefaultExecutorFromPath() throws Exception { final Path testScript = TestUtil.resolveScriptPathForOS("./src/test/scripts/standalone"); final Executor exec = new DefaultExecutor(); exec.setStreamHandler(new PumpStreamHandler()); diff --git a/src/test/java/org/apache/commons/exec/TimeoutObserverTest.java b/src/test/java/org/apache/commons/exec/TimeoutObserverTest.java index 399857cd..9cc3af43 100644 --- a/src/test/java/org/apache/commons/exec/TimeoutObserverTest.java +++ b/src/test/java/org/apache/commons/exec/TimeoutObserverTest.java @@ -42,14 +42,14 @@ public class TimeoutObserverTest { private final TimeoutObserverFixture tof = new TimeoutObserverFixture(); @Test - public void testAccept() { + void testAccept() { assertFalse(tof.b); tof.accept(null); assertTrue(tof.b); } @Test - public void testTimeoutOccured() { + void testTimeoutOccured() { assertFalse(tof.b); tof.timeoutOccured(null); assertTrue(tof.b); diff --git a/src/test/java/org/apache/commons/exec/TutorialTest.java b/src/test/java/org/apache/commons/exec/TutorialTest.java index e0853fde..4c4fa76a 100644 --- a/src/test/java/org/apache/commons/exec/TutorialTest.java +++ b/src/test/java/org/apache/commons/exec/TutorialTest.java @@ -130,7 +130,7 @@ public class TutorialTest { } @Test - public void testTutorialExample() throws Exception { + void testTutorialExample() throws Exception { final Duration printJobTimeout = Duration.ofSeconds(15); final boolean printInBackground = false; diff --git a/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilsTest.java b/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilsTest.java index 0c15cb09..62c6ad7e 100644 --- a/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilsTest.java +++ b/src/test/java/org/apache/commons/exec/environment/EnvironmentUtilsTest.java @@ -47,7 +47,7 @@ public class EnvironmentUtilsTest { * @throws Exception the test failed */ @Test - public void testCaseInsensitiveVariableLookup() throws Exception { + void testCaseInsensitiveVariableLookup() throws Exception { final Map<String, String> procEnvironment = EnvironmentUtils.getProcEnvironment(); // Check that case is preserved for values EnvironmentUtils.addVariableToEnvironment(procEnvironment, "foo=bAr"); @@ -60,7 +60,7 @@ public class EnvironmentUtilsTest { * @throws IOException the test failed */ @Test - public void testGetProcEnvironment() throws IOException { + void testGetProcEnvironment() throws IOException { final Map<String, String> procEnvironment = EnvironmentUtils.getProcEnvironment(); // we assume that there is at least one environment variable // for this process, i.e. $JAVA_HOME @@ -80,7 +80,7 @@ public class EnvironmentUtilsTest { * @throws IOException the test failed */ @Test - public void testGetProcEnvironmentCaseInsensitiveLookup() throws IOException { + void testGetProcEnvironmentCaseInsensitiveLookup() throws IOException { // run tests only on windows platforms if (!OS.isFamilyWindows()) { return; @@ -106,7 +106,7 @@ public class EnvironmentUtilsTest { * Tests the behavior of the EnvironmentUtils.toStrings() when using a {@code null} environment. */ @Test - public void testToStrings() { + void testToStrings() { // check for a non-existing environment when passing null assertNull(EnvironmentUtils.toStrings(null)); // check for an environment when filling in two variables @@ -126,7 +126,7 @@ public class EnvironmentUtilsTest { * Tests the behavior of the EnvironmentUtils.toStrings() when using a {@code null} key given to the map. */ @Test - public void testToStringWithNullKey() { + void testToStringWithNullKey() { final Map<String, String> env = new HashMap<>(); env.put(null, "TheNullKey"); final String[] strings = EnvironmentUtils.toStrings(env); @@ -138,7 +138,7 @@ public class EnvironmentUtilsTest { * Tests the behavior of the EnvironmentUtils.toStrings() when using a {@code null} value given to the map. */ @Test - public void testToStringWithNullValue() { + void testToStringWithNullValue() { final Map<String, String> env = new HashMap<>(); env.put("key", null); final String[] strings = EnvironmentUtils.toStrings(env); diff --git a/src/test/java/org/apache/commons/exec/issues/Exec33Test.java b/src/test/java/org/apache/commons/exec/issues/Exec33Test.java index 67398fac..297dece9 100644 --- a/src/test/java/org/apache/commons/exec/issues/Exec33Test.java +++ b/src/test/java/org/apache/commons/exec/issues/Exec33Test.java @@ -42,7 +42,7 @@ public class Exec33Test { private final File testScript = TestUtil.resolveScriptFileForOS(testDir + "/test"); @Test - public void testExec33() throws Exception { + void testExec33() throws Exception { final CommandLine cl = new CommandLine(testScript); final PumpStreamHandler pumpStreamHandler = new PumpStreamHandler(System.out, System.err, System.in); final DefaultExecutor executor = DefaultExecutor.builder().get(); diff --git a/src/test/java/org/apache/commons/exec/issues/Exec34Test.java b/src/test/java/org/apache/commons/exec/issues/Exec34Test.java index a8832dbb..659c4e60 100644 --- a/src/test/java/org/apache/commons/exec/issues/Exec34Test.java +++ b/src/test/java/org/apache/commons/exec/issues/Exec34Test.java @@ -50,7 +50,7 @@ public class Exec34Test { * @throws Exception the test failed */ @Test - public void testExec34Part1() throws Exception { + void testExec34Part1() throws Exception { final CommandLine cmdLine = new CommandLine(pingScript); cmdLine.addArgument("10"); // sleep 10 seconds @@ -71,7 +71,7 @@ public class Exec34Test { * @throws Exception the test failed */ @Test - public void testExec34Part2() throws Exception { + void testExec34Part2() throws Exception { final CommandLine cmdLine = new CommandLine(pingScript); cmdLine.addArgument("10"); // sleep 10 seconds 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 30302286..d396d66b 100644 --- a/src/test/java/org/apache/commons/exec/issues/Exec36Test.java +++ b/src/test/java/org/apache/commons/exec/issues/Exec36Test.java @@ -55,7 +55,7 @@ public class Exec36Test { */ @Test @Disabled - public void testExec36Part4() throws Exception { + void testExec36Part4() throws Exception { CommandLine cmdl; @@ -77,7 +77,7 @@ public class Exec36Test { */ @Test @Disabled - public void testExec36Part5() { + void testExec36Part5() { CommandLine cmdl; @@ -98,7 +98,7 @@ public class Exec36Test { */ @Test @Disabled - public void testExec36Part6() { + void testExec36Part6() { final String commandLine = "C:\\CVS_DB\\WeightsEngine /f WeightsEngine.mak CFG=\"WeightsEngine - Win32Release\""; @@ -129,7 +129,7 @@ public class Exec36Test { */ @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) - public void testExec36Part1() throws Exception { + void testExec36Part1() throws Exception { CommandLine cmdl; /** @@ -162,7 +162,7 @@ public class Exec36Test { * @throws Exception the test failed */ @Test - public void testExec36Part2() throws Exception { + void testExec36Part2() throws Exception { String expected; 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 f129d23d..24dbc464 100644 --- a/src/test/java/org/apache/commons/exec/issues/Exec41Test.java +++ b/src/test/java/org/apache/commons/exec/issues/Exec41Test.java @@ -50,7 +50,7 @@ public class Exec41Test { * @throws Exception the test failed */ @Test - public void testExec41WithoutStreams() throws Exception { + void testExec41WithoutStreams() throws Exception { final CommandLine cmdLine = new CommandLine(pingScript); cmdLine.addArgument("10"); // sleep 10 seconds @@ -92,7 +92,7 @@ public class Exec41Test { * @throws Exception the test failed */ @Test - public void testExec41WithStreams() throws Exception { + void testExec41WithStreams() throws Exception { CommandLine cmdLine; diff --git a/src/test/java/org/apache/commons/exec/issues/Exec44Test.java b/src/test/java/org/apache/commons/exec/issues/Exec44Test.java index 64cce4d4..468c7c39 100644 --- a/src/test/java/org/apache/commons/exec/issues/Exec44Test.java +++ b/src/test/java/org/apache/commons/exec/issues/Exec44Test.java @@ -49,7 +49,7 @@ public class Exec44Test { * @throws Exception the test failed */ @Test - public void testExec44() throws Exception { + void testExec44() throws Exception { final CommandLine cl = new CommandLine(foreverTestScript); final DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); diff --git a/src/test/java/org/apache/commons/exec/issues/Exec49Test.java b/src/test/java/org/apache/commons/exec/issues/Exec49Test.java index 6295b49c..4c094cc2 100644 --- a/src/test/java/org/apache/commons/exec/issues/Exec49Test.java +++ b/src/test/java/org/apache/commons/exec/issues/Exec49Test.java @@ -48,7 +48,7 @@ public class Exec49Test { */ @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) - public void testExec49Part1() throws Exception { + void testExec49Part1() throws Exception { final CommandLine cl = CommandLine.parse("/bin/ls"); cl.addArgument("/opt"); // redirect stdout/stderr to pipedOutputStream @@ -79,7 +79,7 @@ public class Exec49Test { */ @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) - public void testExec49Part2() throws Exception { + void testExec49Part2() throws Exception { final CommandLine cl = CommandLine.parse("/bin/ls"); cl.addArgument("/opt"); // redirect only stdout to pipedOutputStream diff --git a/src/test/java/org/apache/commons/exec/issues/Exec57Test.java b/src/test/java/org/apache/commons/exec/issues/Exec57Test.java index 8d5dcdda..a34a5ee3 100644 --- a/src/test/java/org/apache/commons/exec/issues/Exec57Test.java +++ b/src/test/java/org/apache/commons/exec/issues/Exec57Test.java @@ -47,7 +47,7 @@ public class Exec57Test extends AbstractExecTest { @Disabled("Broken for Unix-based systems") @Test @Timeout(value = TEST_TIMEOUT, unit = TimeUnit.MILLISECONDS) - public void testExecutionOfBackgroundProcess() throws IOException { + void testExecutionOfBackgroundProcess() throws IOException { final CommandLine cmdLine = new CommandLine("sh").addArgument("-c").addArgument("./src/test/scripts/issues/exec-57-nohup.sh", false); final DefaultExecutor executor = DefaultExecutor.builder().get(); @@ -66,7 +66,7 @@ public class Exec57Test extends AbstractExecTest { @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) @Timeout(value = TEST_TIMEOUT, unit = TimeUnit.MILLISECONDS) - public void testExecutionOfDetachedProcess() throws IOException { + void testExecutionOfDetachedProcess() throws IOException { final CommandLine cmdLine = new CommandLine("sh").addArgument("-c").addArgument("./src/test/scripts/issues/exec-57-detached.sh", false); final DefaultExecutor executor = DefaultExecutor.builder().get(); final PumpStreamHandler pumpStreamHandler = new PumpStreamHandler(System.out, System.err); diff --git a/src/test/java/org/apache/commons/exec/issues/Exec60Test.java b/src/test/java/org/apache/commons/exec/issues/Exec60Test.java index a9f97775..ab49202f 100644 --- a/src/test/java/org/apache/commons/exec/issues/Exec60Test.java +++ b/src/test/java/org/apache/commons/exec/issues/Exec60Test.java @@ -46,7 +46,7 @@ public class Exec60Test extends AbstractExecTest { */ @Disabled("The test is fragile and might fail out of the blue") @Test - public void testExec60() throws Exception { + void testExec60() throws Exception { final int start = 0; final int seconds = 1; diff --git a/src/test/java/org/apache/commons/exec/issues/Exec62Test.java b/src/test/java/org/apache/commons/exec/issues/Exec62Test.java index 59684e91..713dc65a 100644 --- a/src/test/java/org/apache/commons/exec/issues/Exec62Test.java +++ b/src/test/java/org/apache/commons/exec/issues/Exec62Test.java @@ -80,7 +80,7 @@ public class Exec62Test { @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) @Timeout(value = 10, unit = TimeUnit.SECONDS) - public void testMe() throws Exception { + void testMe() throws Exception { execute("exec-62"); } } diff --git a/src/test/java/org/apache/commons/exec/issues/Exec65Test.java b/src/test/java/org/apache/commons/exec/issues/Exec65Test.java index b576ac69..ca17a7db 100644 --- a/src/test/java/org/apache/commons/exec/issues/Exec65Test.java +++ b/src/test/java/org/apache/commons/exec/issues/Exec65Test.java @@ -56,7 +56,7 @@ public class Exec65Test extends AbstractExecTest { // TODO: Fix test for Windows & Linux @EnabledOnOs(value = org.junit.jupiter.api.condition.OS.MAC) @Timeout(value = TEST_TIMEOUT, unit = TimeUnit.MILLISECONDS) - public void testExec65WithSleepUsingShellScript() throws Exception { + void testExec65WithSleepUsingShellScript() throws Exception { final DefaultExecutor executor = DefaultExecutor.builder().get(); executor.setStreamHandler(new PumpStreamHandler(System.out, System.err)); executor.setWatchdog(new ExecuteWatchdog(WATCHDOG_TIMEOUT)); @@ -70,7 +70,7 @@ public class Exec65Test extends AbstractExecTest { */ @Test @Timeout(value = TEST_TIMEOUT, unit = TimeUnit.MILLISECONDS) - public void testExec65WithSleepUsingShellScriptAndJDKOnly() throws Exception { + void testExec65WithSleepUsingShellScriptAndJDKOnly() throws Exception { final Process process = Runtime.getRuntime().exec(resolveTestScript("sleep").getAbsolutePath()); Thread.sleep(WATCHDOG_TIMEOUT); @@ -89,7 +89,7 @@ public class Exec65Test extends AbstractExecTest { @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) @Timeout(value = TEST_TIMEOUT, unit = TimeUnit.MILLISECONDS) - public void testExec65WithSudoUsingShellScript() throws Exception { + void testExec65WithSudoUsingShellScript() throws Exception { assumeFalse(new File(".").getAbsolutePath().contains("travis"), "Test is skipped on travis, because we have to be a sudoer to make the other tests pass."); // TODO: Fails on GitHub @@ -106,7 +106,7 @@ public class Exec65Test extends AbstractExecTest { @Test @DisabledOnOs(org.junit.jupiter.api.condition.OS.WINDOWS) @Timeout(value = TEST_TIMEOUT, unit = TimeUnit.MILLISECONDS) - public void testExec65WitSleepUsingSleepCommandDirectly() throws Exception { + void testExec65WitSleepUsingSleepCommandDirectly() throws Exception { final ExecuteWatchdog watchdog = new ExecuteWatchdog(WATCHDOG_TIMEOUT); final DefaultExecutor executor = DefaultExecutor.builder().get(); final CommandLine command = new CommandLine("sleep"); diff --git a/src/test/java/org/apache/commons/exec/launcher/AbstractCommandLauncherTest.java b/src/test/java/org/apache/commons/exec/launcher/AbstractCommandLauncherTest.java index d72f5326..c3085fd4 100644 --- a/src/test/java/org/apache/commons/exec/launcher/AbstractCommandLauncherTest.java +++ b/src/test/java/org/apache/commons/exec/launcher/AbstractCommandLauncherTest.java @@ -29,14 +29,14 @@ abstract class AbstractCommandLauncherTest<T extends CommandLauncher> { abstract T createCommandLauncher(); @Test - public void testIsFailure() throws Exception { + void testIsFailure() throws Exception { final T commandLauncher = createCommandLauncher(); assertTrue(commandLauncher.isFailure(2)); assertTrue(commandLauncher.isFailure(1)); } @Test - public void testIsFailureZero() throws Exception { + void testIsFailureZero() throws Exception { assertFalse(createCommandLauncher().isFailure(0)); } diff --git a/src/test/java/org/apache/commons/exec/launcher/CommandLauncherFactoryTest.java b/src/test/java/org/apache/commons/exec/launcher/CommandLauncherFactoryTest.java index ca1bf895..7a3e290f 100644 --- a/src/test/java/org/apache/commons/exec/launcher/CommandLauncherFactoryTest.java +++ b/src/test/java/org/apache/commons/exec/launcher/CommandLauncherFactoryTest.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; public class CommandLauncherFactoryTest { @Test - public void testCreateVMLauncher() throws Exception { + void testCreateVMLauncher() throws Exception { assertNotNull(CommandLauncherFactory.createVMLauncher()); } diff --git a/src/test/java/org/apache/commons/exec/launcher/VmsCommandLauncherTest.java b/src/test/java/org/apache/commons/exec/launcher/VmsCommandLauncherTest.java index 67bcacb9..0674465f 100644 --- a/src/test/java/org/apache/commons/exec/launcher/VmsCommandLauncherTest.java +++ b/src/test/java/org/apache/commons/exec/launcher/VmsCommandLauncherTest.java @@ -38,7 +38,7 @@ public class VmsCommandLauncherTest extends AbstractCommandLauncherTest<VmsComma } @Test - public void testCreateCommandFile() throws IOException { + void testCreateCommandFile() throws IOException { final VmsCommandLauncher commandLauncher = createCommandLauncher(); final CommandLine cl = CommandLine.parse("a b \"c d\""); assertNotNull(commandLauncher.createCommandFile(cl, null)); @@ -51,7 +51,7 @@ public class VmsCommandLauncherTest extends AbstractCommandLauncherTest<VmsComma @Override @Test - public void testIsFailure() throws Exception { + void testIsFailure() throws Exception { final CommandLauncher commandLauncher = createCommandLauncher(); assertTrue(commandLauncher.isFailure(2)); assertFalse(commandLauncher.isFailure(1)); @@ -59,7 +59,7 @@ public class VmsCommandLauncherTest extends AbstractCommandLauncherTest<VmsComma @Override @Test - public void testIsFailureZero() throws Exception { + void testIsFailureZero() throws Exception { assertTrue(createCommandLauncher().isFailure(0)); } diff --git a/src/test/java/org/apache/commons/exec/util/MapUtilTest.java b/src/test/java/org/apache/commons/exec/util/MapUtilTest.java index bac61cd4..91e09243 100644 --- a/src/test/java/org/apache/commons/exec/util/MapUtilTest.java +++ b/src/test/java/org/apache/commons/exec/util/MapUtilTest.java @@ -36,7 +36,7 @@ public class MapUtilTest { * Test copying of map */ @Test - public void testCopyMap() throws Exception { + void testCopyMap() throws Exception { final Map<String, String> procEnvironment = new HashMap<>(); procEnvironment.put("JAVA_HOME", "/usr/opt/java"); final Map<String, String> result = MapUtils.copy(procEnvironment); @@ -52,7 +52,7 @@ public class MapUtilTest { * Test merging of maps */ @Test - public void testMergeMap() throws Exception { + void testMergeMap() throws Exception { final Map<String, String> procEnvironment = EnvironmentUtils.getProcEnvironment(); final Map<String, String> applicationEnvironment = new HashMap<>(); applicationEnvironment.put("appMainClass", "foo.bar.Main"); @@ -65,7 +65,7 @@ public class MapUtilTest { * Test prefixing of map */ @Test - public void testPrefixMap() throws Exception { + void testPrefixMap() throws Exception { final Map<String, String> procEnvironment = new HashMap<>(); procEnvironment.put("JAVA_HOME", "/usr/opt/java"); final Map<String, String> result = MapUtils.prefix(procEnvironment, "env"); diff --git a/src/test/java/org/apache/commons/exec/util/StringUtilTest.java b/src/test/java/org/apache/commons/exec/util/StringUtilTest.java index b974d0f0..070a3907 100644 --- a/src/test/java/org/apache/commons/exec/util/StringUtilTest.java +++ b/src/test/java/org/apache/commons/exec/util/StringUtilTest.java @@ -34,7 +34,7 @@ public class StringUtilTest { * Test a default string substitution, e.g. all placeholders are expanded. */ @Test - public void testDefaultStringSubstitution() throws Exception { + void testDefaultStringSubstitution() throws Exception { final Map<String, String> vars = new HashMap<>(); vars.put("foo", "FOO"); vars.put("bar", "BAR"); @@ -47,7 +47,7 @@ public class StringUtilTest { * Test a erroneous template. */ @Test - public void testErroneousTemplate() throws Exception { + void testErroneousTemplate() throws Exception { final Map<String, String> vars = new HashMap<>(); vars.put("foo", "FOO"); @@ -58,7 +58,7 @@ public class StringUtilTest { * Test an incomplete string substitution where not all placeholders are expanded. */ @Test - public void testIncompleteSubstitution() throws Exception { + void testIncompleteSubstitution() throws Exception { final Map<String, String> vars = new HashMap<>(); vars.put("foo", "FOO"); @@ -77,7 +77,7 @@ public class StringUtilTest { * Test no string substitution */ @Test - public void testNoStringSubstitution() throws Exception { + void testNoStringSubstitution() throws Exception { final Map<String, String> vars = new HashMap<>(); vars.put("foo", "FOO"); vars.put("bar", "BAR");