@Test public void testEcho() throws Throwable { SliderTestUtils.skipOnWindows(); String echoText = "hello, world"; initProcess(commandFactory.echo(echoText)); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process stop callback not received", stopped); assertEquals(0, process.getExitCode().intValue()); assertStringInOutput(echoText, getFinalOutput()); }
@Test public void testLs() throws Throwable { initProcess(commandFactory.ls(testDir)); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process start callback not received", started); assertTrue("process stop callback not received", stopped); assertFalse(process.isRunning()); assertEquals(0, process.getExitCode().intValue()); }
@Test public void testEcho() throws Throwable { SliderTestUtils.skipOnWindows(); String echoText = "hello, world"; initProcess(commandFactory.echo(echoText)); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process stop callback not received", stopped); assertEquals(0, process.getExitCode().intValue()); assertStringInOutput(echoText, getFinalOutput()); }
@Test public void testLs() throws Throwable { initProcess(commandFactory.ls(testDir)); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process start callback not received", started); assertTrue("process stop callback not received", stopped); assertFalse(process.isRunning()); assertEquals(0, process.getExitCode().intValue()); }
@Test public void testSetenv() throws Throwable { String var = "TEST_RUN"; String val = "TEST-RUN-ENV-VALUE"; initProcess(commandFactory.env()); process.setEnv(var, val); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process stop callback not received", stopped); assertEquals(0, process.getExitCode().intValue()); assertStringInOutput(val, getFinalOutput()); }
@Test public void testExitCodes() throws Throwable { SliderTestUtils.skipOnWindows(); initProcess(commandFactory.exitFalse()); process.start(); //in-thread wait process.run(); //here stopped assertFalse(process.isRunning()); int exitCode = process.getExitCode(); assertTrue(exitCode != 0); int corrected = process.getExitCodeSignCorrected(); assertEquals(1, corrected); }
@Test public void testSetenv() throws Throwable { String var = "TEST_RUN"; String val = "TEST-RUN-ENV-VALUE"; initProcess(commandFactory.env()); process.setEnv(var, val); process.start(); //in-thread wait process.run(); //here stopped assertTrue("process stop callback not received", stopped); assertEquals(0, process.getExitCode().intValue()); assertStringInOutput(val, getFinalOutput()); }
@Test public void testExitCodes() throws Throwable { SliderTestUtils.skipOnWindows(); initProcess(commandFactory.exitFalse()); process.start(); //in-thread wait process.run(); //here stopped assertFalse(process.isRunning()); int exitCode = process.getExitCode(); assertTrue(exitCode != 0); int corrected = process.getExitCodeSignCorrected(); assertEquals(1, corrected); }