KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > editor > impl > KitsTrackerTest


1 /*
2  * KitsTrackerTest.java
3  *
4  * Created on March 7, 2007, 2:17 PM
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */

9
10 package org.netbeans.modules.editor.impl;
11
12 import java.lang.reflect.Method JavaDoc;
13 import javax.swing.text.EditorKit JavaDoc;
14 import org.netbeans.junit.NbTestCase;
15
16 /**
17  *
18  * @author vita
19  */

20 public class KitsTrackerTest extends NbTestCase {
21     
22     /** Creates a new instance of KitsTrackerTest */
23     public KitsTrackerTest(String JavaDoc name) {
24         super(name);
25     }
26     
27     // o.n.editor.BaseKit uses similar code
28
public void testKitsTrackerCallable() throws Exception JavaDoc {
29         Class JavaDoc clazz = getClass().getClassLoader().loadClass("org.netbeans.modules.editor.impl.KitsTracker"); //NOI18N
30
Method JavaDoc getInstanceMethod = clazz.getDeclaredMethod("getInstance"); //NOI18N
31
Method JavaDoc findMimeTypeMethod = clazz.getDeclaredMethod("findMimeType", Class JavaDoc.class); //NOI18N
32
Object JavaDoc kitsTracker = getInstanceMethod.invoke(null);
33         String JavaDoc mimeType = (String JavaDoc) findMimeTypeMethod.invoke(kitsTracker, EditorKit JavaDoc.class);
34         assertNull("EditorKit.class should not have a mime type", mimeType);
35     }
36 }
37
Popular Tags