View Javadoc
1   package org.codehaus.plexus;
2   
3   import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
4   import org.codehaus.plexus.test.ComponentA;
5   
6   /**
7    * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
8    */
9   public class DefaultComponentLookupManagerTest extends PlexusTestCase {
10      public void testLookupsWithAndWithoutRoleHint() throws Exception {
11          String resource = getConfigurationName("components.xml");
12  
13          System.out.println("resource = " + resource);
14  
15          assertNotNull(resource);
16  
17          ContainerConfiguration c =
18                  new DefaultContainerConfiguration().setName("test").setContainerConfiguration(resource);
19  
20          DefaultPlexusContainer container = new DefaultPlexusContainer(c);
21  
22          try {
23              container.lookup(ComponentA.class);
24  
25              fail("Expected exception");
26          } catch (ComponentLookupException e) {
27              // expected
28          }
29      }
30  }