Execute { public Result toFile(String outPath) { return this.toFile(new File(outPath)); } Execute(String command);  Execute(String[] commandPlusArgs); Execute addEnvPaths(); Execute addAllEnv(); Execute arg(String arg); Execute input(String input); Execute env(String key, String value); Execute clearEnv(); Execute path(String possiblePath); Execute clearPath(); Result toSystemOut(); Result toFile(String outPath); Result toFile(File out); BufferedResult toBuffer();  }
@Test public void toFileOut() { File out = new File("build/out.txt"); if (out.exists()) { out.delete(); } Execute e = new Execute("ls"); Result r = e.toFile("build/out.txt"); assertThat(r.success, is(true)); assertThat(r.exitValue, is(0)); assertThat(Read.fromFile(out, Charset.defaultCharset()).contains("README.markdown"), is(true)); }