KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > languages > fold > EditorTokenInputTest


1 /*
2  * EditorTokenInputTest.java
3  * JUnit based test
4  *
5  * Created on July 17, 2006, 11:17 PM
6  */

7
8 package org.netbeans.modules.languages.fold;
9
10 import junit.framework.TestCase;
11 import org.netbeans.editor.TokenCategory;
12 import org.netbeans.editor.TokenContext;
13 import org.netbeans.editor.TokenContextPath;
14 import org.netbeans.editor.TokenID;
15
16
17 /**
18  *
19  * @author Jan Jancura
20  */

21 public class EditorTokenInputTest extends TestCase {
22     
23     public EditorTokenInputTest (String JavaDoc testName) {
24         super (testName);
25     }
26
27 // public void test1 () {
28
// EditorTokenInput eti = EditorTokenInput.create (
29
// new MTokenItem (1),
30
// Collections.emptySet (),
31
// null
32
// );
33
// assertEquals (eti.next (1).getIdentifier (), "1");
34
// assertEquals (eti.next (2).getIdentifier (), "2");
35
// assertEquals (eti.next (3).getIdentifier (), "3");
36
// assertEquals (eti.next (1).getIdentifier (), "1");
37
// assertEquals (eti.read ().getIdentifier (), "1");
38
// assertEquals (eti.next (1).getIdentifier (), "2");
39
// assertEquals (eti.next (2).getIdentifier (), "3");
40
// assertEquals (eti.next (3).getIdentifier (), "4");
41
// assertEquals (eti.read ().getIdentifier (), "2");
42
// assertEquals (eti.read ().getIdentifier (), "3");
43
// assertEquals (eti.read ().getIdentifier (), "4");
44
// assertEquals (eti.read ().getIdentifier (), "5");
45
// assertEquals (eti.read ().getIdentifier (), "6");
46
// }
47

48     private static TokenCategory TOKEN_CATEGORY = new TokenCategory () {
49         public String JavaDoc getName () {
50             return "category";
51         }
52         public int getNumericID () {
53             return 111;
54         }
55     };
56     
57     private static TokenContextPath TOKEN_CONTEXT_PATH =
58         new MTokenContext ("tokenContext").getContextPath ();
59     
60     private static class MTokenContext extends TokenContext {
61
62         MTokenContext (
63             String JavaDoc name
64         ) {
65             super (name);
66         }
67
68         void addToken (TokenID token) {
69             addTokenID (token);
70         }
71     };
72     
73 // private static class MTokenItem extends AbstractItem {
74
//
75
// private int i;
76
//
77
// MTokenItem (int i) {
78
// super (
79
// new EditorToken ("text/test", "category", "type", 1),
80
// TOKEN_CONTEXT_PATH,
81
// i,
82
// "" + i
83
// );
84
// this.i = i;
85
// }
86
//
87
// public TokenItem getNext () {
88
// return new MTokenItem (i + 1);
89
// }
90
//
91
// public TokenItem getPrevious () {
92
// return new MTokenItem (i - 1);
93
// }
94
//
95
//// private static class MTokenID implements EditorToken {
96
////
97
//// private int i;
98
////
99
//// MTokenID (int i) {
100
//// this.i = i;
101
//// }
102
////
103
//// public TokenCategory getCategory () {
104
//// return TOKEN_CATEGORY;
105
//// }
106
////
107
//// public String getName () {
108
//// return "" + i;
109
//// }
110
////
111
//// public int getNumericID () {
112
//// return i;
113
//// }
114
//// }
115
// }
116
}
117
Popular Tags