### Question:
OSCommand { public String execute() throws CommandLineException { executeCommand(); CommandResultRetriever retriever = new CommandResultRetriever(); retriever.call(); return result; } OSCommand(String command);  OSCommand(String command, boolean verbose);  OSCommand(String command, String workingDirectory);  OSCommand(String command, String workingDirectory, boolean verbose); String getCommand(); String getResult(); int getExitStatus(); boolean isVerbose(); String getWorkingDirectory(); void setWorkingDirectory(String workingDirectory); String execute(); void executeAssync(); void killProcess(); @Override String toString();  }### Answer:
@Test public void testRunLocalCommand() throws CommandLineException { OSCommand com = new OSCommand("echo 42"); String result = com.execute(); assertEquals("42", result.replace("\n", "")); }
@Test(expected = CommandLineException.class) public void shouldThrowExceptionBecauseExistStatus() throws CommandLineException { OSCommand com = new OSCommand("this command does not exit"); com.execute(); }
@Test(expected = CommandLineException.class) public void shouldThrowExceptionBecauseExistStatus2() throws CommandLineException { OSCommand com = new OSCommand("cat arquivo_que_nao_existe"); com.execute(); }