### Question:
SQLFile { public static List<String> statementsFrom(Reader reader) throws IOException { SQLFile file = new SQLFile(); file.parse(reader); return file.getStatements(); }  void parse(Reader in); List<String> getStatements(); static List<String> statementsFrom(Reader reader); static List<String> statementsFrom(File sqlfile);  }### Answer:
@Test public void testReadMultiLineCommand() throws IOException { String firstLine = "CREATE TABLE 'testTable'"; String secondLine = "_id INTEGER PRIMARY KEY AUTOINCREMENT;"; String singleLineCommand = firstLine + " " + secondLine; String multiLineCommand = firstLine + "\n" + secondLine; List<String> statementsFromMultiline = SQLFile.statementsFrom(new StringReader(multiLineCommand)); assertEquals(singleLineCommand, statementsFromMultiline.get(0)); }
@Test public void testSkippingTrailingComments() throws IOException { String rawLine = "CREATE TABLE 'testTable'"; String comment = "-- adding some comment that should get stripped off"; String nextLine = "_id INTEGER PRIMARY KEY AUTOINCREMENT;"; String lineCommand = rawLine + comment + "\n" + nextLine; List<String> statements = SQLFile.statementsFrom(new StringReader(lineCommand)); assertEquals(rawLine + " " + nextLine, statements.get(0)); }