01: /**
02: *
03: */package test.net.sourceforge.pmd.testframework;
04:
05: import static org.junit.Assert.assertEquals;
06:
07: import java.io.IOException;
08: import java.util.List;
09:
10: import net.sourceforge.pmd.cpd.SourceCode;
11: import net.sourceforge.pmd.cpd.TokenEntry;
12: import net.sourceforge.pmd.cpd.Tokenizer;
13: import net.sourceforge.pmd.cpd.Tokens;
14:
15: /**
16: * @author Romain PELISSE, belaran@gmail.com
17: *
18: */
19: public abstract class AbstractTokenizerTest {
20:
21: protected int expectedTokenCount;
22: protected Tokenizer tokenizer;
23: protected SourceCode sourceCode;
24:
25: public abstract void buildTokenizer();
26:
27: public abstract String getSampleCode();
28:
29: protected void tokenizeTest() throws IOException {
30: Tokens tokens = new Tokens();
31: tokenizer.tokenize(sourceCode, tokens);
32: List<TokenEntry> entries = tokens.getTokens();
33: assertEquals(expectedTokenCount, entries.size());
34: }
35:
36: }
|