### Question:
ProcessRunner { public static List<String> runCommand(File workingDirectory, String... command) throws IOException { ProcessBuilder pb = new ProcessBuilder(command); if (workingDirectory != null) { pb.directory(workingDirectory); } pb.redirectErrorStream(true); Process p = start(pb); List<String> outputLines = getOutputLines(p); waitFor(p, command, outputLines); return outputLines; } private  ProcessRunner(); static List<String> runCommand(File workingDirectory, String... command);  }### Answer:
@Test public void testRunCommand() throws IOException { String[] diffCmd = buildDiffCommand(); Repository repository = GitRepository.buildRepository(GitHelper.openCurrentFolder()); List<String> cmdResult = ProcessRunner.runCommand(repository.getDirectory().getParentFile(), diffCmd); String resultAsString = String.join("\n", cmdResult); assertEquals(expectedDiffResult, resultAsString); }
@Test(expected = IOException.class) public void testRunCommand_invalidRevision() throws IOException { List<String> strings = ProcessRunner.runCommand(new File("./nonexistingfolder"), "git", "diff"); assertTrue(true); }