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    * @version $Id$
9    */
10  public class DefaultComponentLookupManagerTest
11      extends PlexusTestCase
12  {
13      public void testLookupsWithAndWithoutRoleHint()
14          throws Exception
15      {
16          String resource = getConfigurationName( "components.xml" );
17  
18          System.out.println( "resource = " + resource );
19  
20          assertNotNull( resource );
21  
22          ContainerConfiguration c = new DefaultContainerConfiguration()
23              .setName( "test" )
24              .setContainerConfiguration( resource );
25  
26          DefaultPlexusContainer container = new DefaultPlexusContainer( c );
27  
28          try
29          {
30              container.lookup( ComponentA.class );
31  
32              fail( "Expected exception" );
33          }
34          catch ( ComponentLookupException e )
35          {
36              // expected
37          }
38      }
39  }