示例#1
0
  @Test
  public void testLookup() {
    Lookup<IPriorityFoo> lookup = Lookups.getPriority(IPriorityFoo.class);

    // This should only be ImplB, which has the highest priority.
    IFoo myFoo = lookup.lookup();
    LOG.info("Got foo implementation: " + myFoo.getClass().getName());
    assertTrue(myFoo instanceof Providers.PriorityImplB);

    String result = myFoo.getMessage();
    LOG.info("Got result string: " + result);
    assertEquals("priorityimplB", result);
  }