ProcessExecutor { public Optional<ProcessResult> execute(String command) throws IOException { return execute(command, null); } private  ProcessExecutor(int timeoutSeconds, int[] successExitCodes); Optional<ProcessResult> execute(String command); Optional<ProcessResult> execute(String command, String processInput); final int timeoutSeconds; }
@Test public void echo_can_be_executed() throws Exception { final String message = "Hello from executor!"; ProcessExecutor executor = new ProcessExecutor.Builder(10).build(); Optional<ProcessResult> result = executor.execute("echo " + message); assertTrue(result.isPresent()); assertEquals(message, result.get().stdOut.trim()); assertEquals("", result.get().stdErr); }