1 19 20 package org.netbeans.lib.java.lexer; 21 22 import java.util.Arrays ; 23 import java.util.Collection ; 24 import java.util.Set ; 25 import junit.framework.TestCase; 26 import org.netbeans.api.java.lexer.JavaTokenId; 27 import org.netbeans.api.lexer.Language; 28 import org.netbeans.api.lexer.TokenId; 29 import org.netbeans.lib.lexer.test.LexerTestUtilities; 30 31 32 37 public class JavaLanguageTest extends TestCase { 38 39 private static final int IDS_SIZE = 10; 40 41 public JavaLanguageTest(String testName) { 42 super(testName); 43 } 44 45 protected void setUp() throws java.lang.Exception { 46 } 47 48 protected void tearDown() throws java.lang.Exception { 49 } 50 51 public void testTokenIds() { 52 Language language = JavaTokenId.language(); 54 55 Set testCats = language.tokenCategories(); 57 Collection cats = Arrays.asList(new String [] { 58 "error", "identifier", "operator", "separator", "whitespace", "error", "comment", 59 "keyword", "string", "character", "number", "literal", 60 }); 61 LexerTestUtilities.assertCollectionsEqual("Invalid categories", cats, testCats); 62 63 LexerTestUtilities.assertCollectionsEqual("Invalid category members", 64 language.tokenCategoryMembers("whitespace"), 65 Arrays.asList(new TokenId[] { 66 JavaTokenId.WHITESPACE, 67 }) 68 ); 69 70 71 } 72 73 } 74 | Popular Tags |