AbstractCharStreamScanner implements CharStreamScanner { @Override public String readLine() { return readLine(false); } AbstractCharStreamScanner(); @Override int readDigit(); @Override double readDouble(); @Override float readFloat(); @Override int skipWhile(CharFilter filter); @Override char skipWhileAndPeek(CharFilter filter); @Override char skipWhileAndPeek(CharFilter filter, int max); @Override String readWhile(CharFilter filter); @Override String readUntil(CharFilter filter, boolean acceptEof, String stop); @Override String readUntil(CharFilter filter, boolean acceptEot, String stop, boolean ignoreCase); @Override boolean skipOver(String substring); @Override boolean skipOver(String substring, boolean ignoreCase); @Override String readLine(); @Override boolean expect(String expected); @Override boolean expectStrict(String expected); @Override Character readJavaCharLiteral(); @Override String readJavaStringLiteral();  }
@Test public void testReadLine() { String string = "abc\ndef\rghi\r\njkl\n\rend"; CharStreamScanner scanner = scanner(string); assertThat(scanner.readLine()).isEqualTo("abc"); assertThat(scanner.readLine()).isEqualTo("def"); assertThat(scanner.readLine()).isEqualTo("ghi"); assertThat(scanner.readLine()).isEqualTo("jkl"); assertThat(scanner.readLine()).isEmpty(); assertThat(scanner.readLine()).isEqualTo("end"); }
@Test public void testReadLineWithTrim() { String string = " ab c \ndef\r ghi\r\nj k l\n \r \n \r\n end"; CharStreamScanner scanner = scanner(string); assertThat(scanner.readLine(true)).isEqualTo("ab c"); assertThat(scanner.readLine(true)).isEqualTo("def"); assertThat(scanner.readLine(true)).isEqualTo("ghi"); assertThat(scanner.readLine(true)).isEqualTo("j k l"); assertThat(scanner.readLine(true)).isEmpty(); assertThat(scanner.readLine(true)).isEmpty(); assertThat(scanner.readLine(true)).isEmpty(); assertThat(scanner.readLine(true)).isEqualTo("end"); }