01: package org.acm.seguin.pretty;
02:
03: import junit.framework.TestCase;
04: import net.sourceforge.jrefactory.parser.Token;
05:
06: public class TestJavadocTokenizer extends TestCase {
07: public TestJavadocTokenizer(String name) {
08: super (name);
09: }
10:
11: public void test01() {
12: String content = "**** \n"
13: + "\t\t* This software is supposed to <B>break</B>\n"
14: + "\t\t* this message up into <strong>line<em>s</em></strong>\n"
15: + "\t\t* @param input the input to this method\n"
16: + "\t\t* @version @version@\n" + "\t\t*";
17:
18: int[] desired = { JavadocTokenizer.NEWLINE,
19: JavadocTokenizer.SPACE, JavadocTokenizer.NEWLINE,
20: JavadocTokenizer.SPACE, JavadocTokenizer.WORD,
21: JavadocTokenizer.SPACE, JavadocTokenizer.WORD,
22: JavadocTokenizer.SPACE, JavadocTokenizer.WORD,
23: JavadocTokenizer.SPACE, JavadocTokenizer.WORD,
24: JavadocTokenizer.SPACE, JavadocTokenizer.WORD,
25: JavadocTokenizer.SPACE, JavadocTokenizer.WORD,
26: JavadocTokenizer.WORD, JavadocTokenizer.WORD,
27: JavadocTokenizer.NEWLINE };
28: JavadocTokenizer tokenizer = new JavadocTokenizer(content);
29:
30: int current = 0;
31: while (tokenizer.hasNext()) {
32: Token word = tokenizer.next();
33: if (current < desired.length) {
34: assertEquals("Correct type for index: " + current,
35: desired[current], word.kind);
36: }
37: current++;
38: }
39:
40: assertEquals("Correct number of tokens", 54, current);
41: }
42: }
|