KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > lexer > CustomTokenClassTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.api.lexer;
21
22 import org.netbeans.junit.NbTestCase;
23
24 /**
25  *
26  * @author vita
27  */

28 public class CustomTokenClassTest extends NbTestCase {
29
30     public CustomTokenClassTest(String JavaDoc name) {
31         super(name);
32     }
33
34     public void testCustomTokenClass() throws Exception JavaDoc {
35         try {
36             Token token = new CustomToken();
37             fail("IllegalStateException expected from constructor of Token class.");
38         } catch (IllegalStateException JavaDoc e) {
39             // Expected ISE from Token's constructor.
40
}
41     }
42     
43     private static final class CustomToken extends Token {
44         
45         public TokenId id() {
46             return null;
47         }
48
49         public CharSequence JavaDoc text() {
50             return null;
51         }
52
53         public boolean isCustomText() {
54             return false;
55         }
56
57         public int length() {
58             return 0;
59         }
60
61         public int offset(TokenHierarchy tokenHierarchy) {
62             return 0;
63         }
64
65         public boolean isFlyweight() {
66             return false;
67         }
68
69         public boolean isPreprocessedText() {
70             return false;
71         }
72
73         public CharSequence JavaDoc preprocessedText() {
74             return null;
75         }
76
77         public String JavaDoc preprocessError() {
78             return null;
79         }
80
81         public int preprocessErrorIndex() {
82             return 0;
83         }
84
85         public boolean hasProperties() {
86             return false;
87         }
88
89         public Object JavaDoc getProperty(Object JavaDoc key) {
90             return false;
91         }
92         
93         public PartType partType() {
94             return null;
95         }
96         
97     }
98
99 }
100
Popular Tags