### Question:
DefaultPatchParser extends SimpleParser implements PatchParser { public ParseResult parse(InputStream inputStream, ConfigurationEntry ce) throws IOException { Charset charset = ce == null ? Charset.defaultCharset() : ce.getPatchEncoding(); LogFactory.getInstance().debug("Patch encoding set to " + charset.displayName() + (ce == null ? " (system default)" : "")); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream, charset)); StringBuilder sb = new StringBuilder(); String l; while ((l = br.readLine()) != null) { sb.append(l).append('\n'); } br.close(); final List<PatchStatement> statements = new LinkedList<PatchStatement>(); parse(sb.toString(), new SqlParserCallback(statements)); return new ParseResult() { public int totalCount() { return statements.size(); } public List<PatchStatement> getStatements() { return Collections.unmodifiableList(statements); } public int executableCount() { int c = 0; for (PatchStatement ps : statements) { if (ps.isExecutable()) { c++; } } return c; } }; } DefaultPatchParser(); ParseResult parse(InputStream inputStream, ConfigurationEntry ce); ParseResult parse(AbstractPatch p, ConfigurationEntry ce);  }### Answer:
@Test public void parse() throws IOException { DefaultPatchParser parser = new DefaultPatchParser(); List<PatchStatement> list = parser.parse(getClass().getResourceAsStream("input.txt"), null).getStatements(); assertEquals(6, countStatements(list, true)); assertEquals(4, countStatements(list, false)); }
@Test public void parseBlock() throws IOException { DefaultPatchParser parser = new DefaultPatchParser(); List<PatchStatement> list = parser.parse(getClass().getResourceAsStream("input-block.txt"), null).getStatements(); assertEquals(4, countStatements(list, true)); assertEquals(3, countStatements(list, false)); }
@Test public void parseSemicon() throws IOException { DefaultPatchParser parser = new DefaultPatchParser(); ByteArrayInputStream bais = new ByteArrayInputStream("INSERT INTO a (\"ab;c\\\"d\", 'za;p\\'o')".getBytes()); List<PatchStatement> list = parser.parse(bais, null).getStatements(); assertEquals(1, countStatements(list, true)); assertEquals("INSERT INTO a (\"ab;c\\\"d\", 'za;p\\'o')", list.get(0).getCode()); }
@Test public void comments() throws IOException { DefaultPatchParser parser = new DefaultPatchParser(); List<PatchStatement> list = parser.parse(getClass().getResourceAsStream("input-comments.txt"), null).getStatements(); assertEquals(4, countStatements(list, true)); assertEquals(3, countStatements(list, false)); }