#103300: Unsuccessful simulation of Zavadsky's problem after_vw-license_update_May11 before_vw-license_update_May11 designer_xhtmlrenderer_root uichanges_102289_root
authorjtulach@netbeans.org
Fri, 04 May 2007 16:28:15 +0000
changeset 280d3a1611fbb05
parent 279 7e829aa7267a
child 281 a0e3d2f82b5b
#103300: Unsuccessful simulation of Zavadsky's problem
openide.util/test/unit/src/org/openide/util/lookup/LookupsProxyTest.java
     1.1 --- a/openide.util/test/unit/src/org/openide/util/lookup/LookupsProxyTest.java	Fri Apr 27 02:13:42 2007 +0000
     1.2 +++ b/openide.util/test/unit/src/org/openide/util/lookup/LookupsProxyTest.java	Fri May 04 16:28:15 2007 +0000
     1.3 @@ -217,6 +217,28 @@
     1.4          assertEquals("3x100+1 checks", 301, listener.round);
     1.5      }
     1.6      
     1.7 +    
     1.8 +    public void testRefreshWithoutAllInstances103300 () {
     1.9 +        Changer ch = new Changer (Lookup.EMPTY);
    1.10 +        
    1.11 +        Lookup lookup = Lookups.proxy(ch);
    1.12 +
    1.13 +        ch.setLookup (new AbstractLookup (new InstanceContent ())); // another empty lookup
    1.14 +        assertNull("Nothing there", lookup.lookup (Object.class)); // does the refresh
    1.15 +        
    1.16 +        InstanceContent content = new InstanceContent ();
    1.17 +        AbstractLookup del = new AbstractLookup (content);
    1.18 +        content.add (this);
    1.19 +        ch.setLookup (del);
    1.20 +        assertEquals("Can see me", this, lookup.lookup (Object.class));
    1.21 +        
    1.22 +        ch.setLookup (del);
    1.23 +        assertEquals("Still can see me", this, lookup.lookup (Object.class));
    1.24 +
    1.25 +        assertEquals("I am visible", this, lookup.lookup(LookupsProxyTest.class));
    1.26 +    }
    1.27 +
    1.28 +
    1.29      private static final class Changer implements Lookup.Provider {
    1.30          private Lookup lookup;
    1.31          
    1.32 @@ -232,4 +254,5 @@
    1.33              return lookup;
    1.34          }
    1.35      }
    1.36 +
    1.37  }