/** 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#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()); }