1 19 20 package org.netbeans.modules.settings; 21 22 import org.netbeans.junit.NbTestCase; 23 import org.openide.filesystems.FileObject; 24 25 import org.openide.filesystems.FileSystem; 26 import org.openide.modules.ModuleInfo; 27 import org.openide.util.Lookup; 28 29 33 public class EnvTest extends NbTestCase { 34 FileSystem fs; 35 36 37 public EnvTest(String name) { 38 super(name); 39 } 40 41 protected void setUp() throws Exception { 42 super.setUp(); 43 44 Lookup.getDefault().lookup(ModuleInfo.class); 45 fs = org.openide.filesystems.Repository.getDefault().getDefaultFileSystem(); 46 } 47 48 public void testFindEntityRegistration() throws Exception { 49 String provider = "xml/lookups/NetBeans_org_netbeans_modules_settings_xtest/DTD_XML_FooSetting_1_0.instance"; 50 FileObject fo = fs.findResource(provider); 51 assertNotNull("provider registration not found: " + provider, fo); 52 assertNotNull("entity registration not found for " + provider, Env.findEntityRegistration(fo)); 53 } 54 55 public void testFindProvider() throws Exception { 56 Class clazz = org.netbeans.modules.settings.convertors.FooSetting.class; 57 FileObject fo = Env.findProvider(clazz); 58 assertNotNull("xml/memory registration not found: " + clazz.getName(), fo); 59 } 60 61 public void testFindProviderFromSuperClass() throws Exception { 62 Class clazz = org.netbeans.modules.settings.convertors.Bar3Setting.class; 63 FileObject fo = Env.findProvider(clazz); 64 assertNotNull("xml/memory registration not found: " + clazz.getName(), fo); 65 } 66 67 public void testFindProviderFromSuperClass2() throws Exception { 68 Class clazz = org.netbeans.modules.settings.convertors.Bar4Setting.class; 69 FileObject fo = Env.findProvider(clazz); 70 assertNull("xml/memory registration found: " + clazz.getName(), fo); 71 } 72 } 73 | Popular Tags |