/** Test method for {@link DefaultJavadocTokenStream#nextToken()}. */
 @Test
 public void testNextTokenSimple() {
   DefaultJavadocTokenStream stream = stream("alphabets.txt");
   for (char c = 'a'; c <= 'z'; c++) {
     assertEquals(String.valueOf(c), stream.nextToken().getText());
   }
   assertEquals(EOF, stream.nextToken().getKind());
   assertEquals(EOF, stream.nextToken().getKind());
 }
 /** Test method for {@link DefaultJavadocTokenStream#nextToken()}. */
 @Test
 public void testNextTokenLines() {
   DefaultJavadocTokenStream stream = stream("blank-lines.txt");
   assertEquals("a", stream.nextToken().getText());
   assertEquals("b", stream.nextToken().getText());
   assertEquals("c", stream.nextToken().getText());
   assertEquals("d", stream.nextToken().getText());
   assertEquals(EOF, stream.nextToken().getKind());
   assertEquals(EOF, stream.nextToken().getKind());
 }
 /** Test method for {@link DefaultJavadocTokenStream#rewind()}. */
 @Test
 public void testRewind() {
   DefaultJavadocTokenStream stream = stream("blank-lines.txt");
   stream.mark();
   assertEquals("a", stream.nextToken().getText());
   stream.mark();
   assertEquals("b", stream.nextToken().getText());
   stream.rewind();
   assertEquals("b", stream.nextToken().getText());
   stream.rewind();
   assertEquals("a", stream.nextToken().getText());
   try {
     stream.rewind();
     fail();
   } catch (IllegalStateException e) {
     // ok.
   }
 }
  /** Test method for {@link DefaultJavadocTokenStream#lookahead(int)}. */
  @Test
  public void testLookahead() {
    DefaultJavadocTokenStream stream = stream("alphabets.txt");

    assertEquals("a", stream.lookahead(0).getText());
    assertEquals("a", stream.lookahead(0).getText());
    assertEquals("b", stream.lookahead(2).getText());
    assertEquals("c", stream.lookahead(4).getText());
    assertEquals("d", stream.lookahead(6).getText());
    assertEquals("e", stream.lookahead(8).getText());

    stream.nextToken();
    assertEquals("b", stream.lookahead(1).getText());
    assertEquals("c", stream.lookahead(3).getText());
    assertEquals("d", stream.lookahead(5).getText());
  }
  /** Test method for {@link DefaultJavadocTokenStream#peek()}. */
  @Test
  public void testPeek() {
    DefaultJavadocTokenStream stream = stream("alphabets.txt");

    assertEquals("a", stream.peek().getText());
    assertEquals("a", stream.peek().getText());
    assertEquals("a", stream.peek().getText());

    stream.nextToken();

    assertEquals("b", stream.peek().getText());
    assertEquals("b", stream.peek().getText());
    assertEquals("b", stream.peek().getText());
  }
  /** Test method for {@link DefaultJavadocTokenStream#mark()}. */
  @Test
  public void testMark() {
    DefaultJavadocTokenStream stream = stream("blank-lines.txt");
    stream.mark();
    assertEquals("a", stream.nextToken().getText());
    stream.mark();
    assertEquals("b", stream.nextToken().getText());
    stream.mark();
    assertEquals("c", stream.nextToken().getText());
    stream.mark();
    assertEquals("d", stream.nextToken().getText());

    stream.rewind();
    assertEquals("d", stream.nextToken().getText());
    stream.rewind();
    assertEquals("c", stream.nextToken().getText());
    stream.rewind();
    assertEquals("b", stream.nextToken().getText());
    stream.rewind();
    assertEquals("a", stream.nextToken().getText());
  }