}
private JTextFile createTextFile(String fileName, JSProgram... programs)
throws IOException {
Validate.notNull(fileName);
final JTextFile textFile = new JTextFile(fileName);
final StringWriter stringWriter = new StringWriter();
final CodeWriter codeWriter = new CodeWriter(stringWriter);
for (JSProgram program : programs) {
codeWriter.program(program);
codeWriter.lineTerminator();
}
textFile.setContents(stringWriter.toString());
return textFile;
}