rt/aot-nb-test/src/test/java/org/apidesign/bck2brwsr/aot/nb/test/LookupGetTest.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 11 Sep 2015 14:51:09 +0200
branchflow
changeset 1842 dd4dabfead82
parent 1731 212379f827b6
permissions -rw-r--r--
Giving the flow analyzer chance to generate the whole function body
jaroslav@1728
     1
/**
jaroslav@1728
     2
 * Back 2 Browser Bytecode Translator
jaroslav@1787
     3
 * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@1728
     4
 *
jaroslav@1728
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@1728
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@1728
     7
 * the Free Software Foundation, version 2 of the License.
jaroslav@1728
     8
 *
jaroslav@1728
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@1728
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@1728
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@1728
    12
 * GNU General Public License for more details.
jaroslav@1728
    13
 *
jaroslav@1728
    14
 * You should have received a copy of the GNU General Public License
jaroslav@1728
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@1728
    16
 * If not, see http://opensource.org/licenses/GPL-2.0.
jaroslav@1728
    17
 */
jaroslav@1728
    18
package org.apidesign.bck2brwsr.aot.nb.test;
jaroslav@1728
    19
jaroslav@1728
    20
import org.apidesign.bck2brwsr.vmtest.Compare;
jaroslav@1728
    21
import org.apidesign.bck2brwsr.vmtest.VMTest;
jaroslav@1728
    22
import org.openide.util.Lookup;
jaroslav@1731
    23
import org.openide.util.lookup.ServiceProvider;
jaroslav@1728
    24
import org.testng.annotations.Factory;
jaroslav@1728
    25
jaroslav@1728
    26
/**
jaroslav@1728
    27
 *
jaroslav@1728
    28
 * @author Jaroslav Tulach
jaroslav@1728
    29
 */
jaroslav@1728
    30
public class LookupGetTest {
jaroslav@1728
    31
    
jaroslav@1728
    32
    @Compare public boolean getDefault() {
jaroslav@1728
    33
        return Lookup.getDefault() != null;
jaroslav@1728
    34
    }
jaroslav@1728
    35
jaroslav@1731
    36
    @Compare public String findImpl() {
jaroslav@1731
    37
        Iface a = Lookup.getDefault().lookup(Iface.class);
jaroslav@1731
    38
        return a.getClass().getName();
jaroslav@1731
    39
    }
jaroslav@1731
    40
jaroslav@1728
    41
    @Factory public static Object[] create() {
jaroslav@1728
    42
        return VMTest.create(LookupGetTest.class);
jaroslav@1728
    43
    }
jaroslav@1731
    44
    
jaroslav@1731
    45
    public static interface Iface {
jaroslav@1731
    46
    }
jaroslav@1731
    47
jaroslav@1731
    48
    @ServiceProvider(service = Iface.class)
jaroslav@1731
    49
    public static final class Impl implements Iface {
jaroslav@1731
    50
    }
jaroslav@1728
    51
}