Verifying that Lookup.getDefault can find implementation
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 27 Nov 2014 20:31:17 +0100
changeset 1731212379f827b6
parent 1730 795b040ac8f2
child 1732 5ab1cb07a530
Verifying that Lookup.getDefault can find implementation
rt/aot-nb-test/src/test/java/org/apidesign/bck2brwsr/aot/nb/test/LookupGetTest.java
     1.1 --- a/rt/aot-nb-test/src/test/java/org/apidesign/bck2brwsr/aot/nb/test/LookupGetTest.java	Thu Nov 27 20:23:35 2014 +0100
     1.2 +++ b/rt/aot-nb-test/src/test/java/org/apidesign/bck2brwsr/aot/nb/test/LookupGetTest.java	Thu Nov 27 20:31:17 2014 +0100
     1.3 @@ -20,6 +20,7 @@
     1.4  import org.apidesign.bck2brwsr.vmtest.Compare;
     1.5  import org.apidesign.bck2brwsr.vmtest.VMTest;
     1.6  import org.openide.util.Lookup;
     1.7 +import org.openide.util.lookup.ServiceProvider;
     1.8  import org.testng.annotations.Factory;
     1.9  
    1.10  /**
    1.11 @@ -32,7 +33,19 @@
    1.12          return Lookup.getDefault() != null;
    1.13      }
    1.14  
    1.15 +    @Compare public String findImpl() {
    1.16 +        Iface a = Lookup.getDefault().lookup(Iface.class);
    1.17 +        return a.getClass().getName();
    1.18 +    }
    1.19 +
    1.20      @Factory public static Object[] create() {
    1.21          return VMTest.create(LookupGetTest.class);
    1.22      }
    1.23 +    
    1.24 +    public static interface Iface {
    1.25 +    }
    1.26 +
    1.27 +    @ServiceProvider(service = Iface.class)
    1.28 +    public static final class Impl implements Iface {
    1.29 +    }
    1.30  }