AbstractCharStreamScanner implements CharStreamScanner { @Override public Character readJavaCharLiteral() { return readJavaCharLiteral(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 testReadJavaCharLiteral() { String string = "'a'$'\\''$'\\\\'$'\\0'$'\\47'$'\\176'$'\\u2022'$"; CharStreamScanner scanner = scanner(string); assertThat(scanner.readJavaCharLiteral()).isEqualTo('a'); assertThat(scanner.expect('$')).isTrue(); assertThat(scanner.readJavaCharLiteral()).isEqualTo('\''); assertThat(scanner.expect('$')).isTrue(); assertThat(scanner.readJavaCharLiteral()).isEqualTo('\\'); assertThat(scanner.expect('$')).isTrue(); assertThat(scanner.readJavaCharLiteral()).isEqualTo('\0'); assertThat(scanner.expect('$')).isTrue(); assertThat(scanner.readJavaCharLiteral()).isEqualTo('\''); assertThat(scanner.expect('$')).isTrue(); assertThat(scanner.readJavaCharLiteral()).isEqualTo('~'); assertThat(scanner.expect('$')).isTrue(); assertThat(scanner.readJavaCharLiteral()).isEqualTo('•'); assertThat(scanner.expect('$')).isTrue(); assertThat(scanner.hasNext()).isFalse(); string = "'a''\\'''\\\\''\\0''\\47''\\176''\\u2022'"; scanner = scanner(string); assertThat(scanner.readJavaCharLiteral()).isEqualTo('a'); assertThat(scanner.readJavaCharLiteral()).isEqualTo('\''); assertThat(scanner.readJavaCharLiteral()).isEqualTo('\\'); assertThat(scanner.readJavaCharLiteral()).isEqualTo('\0'); assertThat(scanner.readJavaCharLiteral()).isEqualTo('\''); assertThat(scanner.readJavaCharLiteral()).isEqualTo('~'); assertThat(scanner.readJavaCharLiteral()).isEqualTo('•'); assertThat(scanner.hasNext()).isFalse(); }