### Question:
DefaultJavadocScanner implements JavadocScanner { @Override public int getIndex() { return this.index; } 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 testGetIndex() { String text = load("synopsis.doc.txt"); DefaultJavadocScanner scanner = DefaultJavadocScanner.newInstance(text); int index = 0; while (true) { assertEquals(index, scanner.getIndex()); JavadocToken t = scanner.nextToken(); if (t.getKind() == EOF) { break; } index++; } assertEquals(index, scanner.getIndex()); scanner.nextToken(); assertEquals(index, scanner.getIndex()); }