1 19 20 package org.netbeans.modules.masterfs; 21 22 import junit.framework.*; 23 import org.openide.util.Lookup; 24 import org.openide.util.lookup.AbstractLookup; 25 import org.openide.util.lookup.InstanceContent; 26 import org.openide.util.lookup.ProxyLookup; 27 28 32 public class GlobalVisibilityQueryImplTest extends TestCase { 33 private static GlobalVisibilityQueryImpl vq = new GlobalVisibilityQueryImpl() { 34 protected String getIgnoredFiles() { 35 return "^(CVS|SCCS|vssver\\.scc|#.*#|%.*%|\\.(cvsignore|svn|DS_Store)|_svn)$|~$|^\\..*$"; } 37 }; 38 39 static { 40 System.setProperty("org.openide.util.Lookup", GlobalVisibilityQueryImplTest.TestLookup.class.getName()); 41 } 42 43 public GlobalVisibilityQueryImplTest (String testName) { 44 super(testName); 45 } 46 47 public static Test suite() { 48 return new TestSuite(GlobalVisibilityQueryImplTest .class); 49 } 50 51 public void testVisibility() { 52 assertFalse(vq.isVisible(".#telnetrc")); 53 assertFalse(vq.isVisible("._telnetrc")); 54 assertFalse(vq.isVisible(".#_telnetrc")); 55 assertFalse(vq.isVisible(".cvsignore")); 56 assertFalse(vq.isVisible("CVS")); 57 assertFalse(vq.isVisible(".svn")); 58 assertFalse(vq.isVisible("_svn")); 59 60 assertFalse(vq.isVisible(".telnetrc")); 61 } 62 63 public static class TestLookup extends ProxyLookup { 64 public TestLookup() { 65 super(); 66 setLookups(new Lookup[] {getInstanceLookup()}); 67 } 68 69 private Lookup getInstanceLookup() { 70 InstanceContent instanceContent = new InstanceContent(); 71 instanceContent.add(vq); 72 Lookup instanceLookup = new AbstractLookup(instanceContent); 73 return instanceLookup; 74 } 75 } 76 } 77 | Popular Tags |