### Question:
DefaultJavadocScanner implements JavadocScanner { @Override public JavadocToken lookahead(int offset) { int position = lookahead0(offset); JavadocToken token = token(position); return token; } DefaultJavadocScanner(List<JavadocToken> tokens, int successorStartsAt); static DefaultJavadocScanner newInstance(String text); @Override List<JavadocToken> getTokens(); @Override int getIndex(); @Override void seek(int position); @Override void consume(int count); @Override JavadocToken nextToken(); @Override JavadocToken lookahead(int offset); @Override String toString();  }### Answer:
@Test public void testLookahead() { String text = load("empty.doc.txt"); DefaultJavadocScanner scanner = DefaultJavadocScanner.newInstance(text); assertEquals(SLASH, scanner.lookahead(0).getKind()); assertEquals(ASTERISK, scanner.lookahead(1).getKind()); assertEquals(ASTERISK, scanner.lookahead(2).getKind()); assertEquals(ASTERISK, scanner.lookahead(3).getKind()); assertEquals(SLASH, scanner.lookahead(4).getKind()); assertEquals(EOF, scanner.lookahead(5).getKind()); assertEquals(EOF, scanner.lookahead(6).getKind()); assertEquals(EOF, scanner.lookahead(7).getKind()); scanner.consume(3); assertEquals(SLASH, scanner.lookahead(-3).getKind()); assertEquals(ASTERISK, scanner.lookahead(-2).getKind()); assertEquals(ASTERISK, scanner.lookahead(-1).getKind()); assertEquals(ASTERISK, scanner.lookahead(0).getKind()); assertEquals(SLASH, scanner.lookahead(1).getKind()); assertEquals(EOF, scanner.lookahead(2).getKind()); assertEquals(EOF, scanner.lookahead(3).getKind()); assertEquals(EOF, scanner.lookahead(4).getKind()); }