### Question:
Script extends ShellCommand implements Iterable<ShellCommand> { public Script(List<ShellCommand> commands) { this.commands = new ArrayList<ShellCommand>(commands); } Script(List<ShellCommand> commands); @Override void execute(ShellCommandHandler handler); Iterator<ShellCommand> iterator(); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void toFileShouldCreateANonEmptyFile() throws FileNotFoundException { final ShellCommand script = script(history(), version(), exit()); final String destination = "test.txt"; script.toFile(destination); File file = new File(destination); assertThat("no file generated!", file.exists()); assertThat("empty file generated!", file.length(), is(greaterThan(0L))); file.delete(); }
@Test public void generatedScriptsShouldBeReadble() throws Exception { final String destination = "test.txt"; final ShellCommand script = script(history(), version(), exit()); try { script.toFile(destination); final ShellCommand script2 = fromFile(destination); assertThat("Different files", script2, is(equalTo(script))); } catch (Exception e) { throw e; } finally { File file = new File(destination); file.delete(); } }