1 19 20 package org.netbeans.modules.masterfs; 21 22 import org.netbeans.junit.NbTestCase; 23 import org.openide.filesystems.FileObject; 24 import org.openide.filesystems.FileUtil; 25 import org.openide.util.Lookup; 26 import org.openide.util.lookup.Lookups; 27 28 31 public class URLMapperTest extends NbTestCase { 32 public URLMapperTest(String name) { 33 super(name); 34 } 35 36 37 public void testURLMapperCallingFromMetaInfLookup() { 38 Lookup lkp = Lookups.metaInfServices(Thread.currentThread().getContextClassLoader()); 39 Object obj = lkp.lookup(Object .class); 40 assertNotNull(obj); 41 assertEquals(MyInstance2.class, obj.getClass()); 42 } 43 44 public static class MyInstance2 { 45 public MyInstance2() { 46 super(); 47 testURLMapper(); 48 } 49 50 private static void testURLMapper() { 51 MasterFileSystem mfs = MasterFileSystem.getDefault(); 52 FileObject[] children = mfs.getRoot().getChildren(); 53 for (int i = 0; i < children.length; i++) { 54 java.io.File file = FileUtil.toFile(children[i]); 55 assertNotNull(file); 56 assertNotNull(FileUtil.toFileObject(file)); 57 } 58 } 59 60 } 61 62 } 63 | Popular Tags |