1 10 11 package org.picocontainer.defaults; 12 13 import org.picocontainer.ComponentAdapter; 14 import org.picocontainer.PicoInitializationException; 15 import org.picocontainer.PicoIntrospectionException; 16 import org.picocontainer.tck.AbstractComponentAdapterFactoryTestCase; 17 import org.picocontainer.testmodel.SimpleTouchable; 18 import org.picocontainer.testmodel.Touchable; 19 20 public class DefaultComponentAdapterFactoryTestCase extends AbstractComponentAdapterFactoryTestCase { 21 protected ComponentAdapterFactory createComponentAdapterFactory() { 22 return new DefaultComponentAdapterFactory(); 23 } 24 25 public void testInstantiateComponentWithNoDependencies() throws PicoInitializationException, PicoIntrospectionException, AssignabilityRegistrationException, NotConcreteRegistrationException { 26 ComponentAdapter componentAdapter = 27 createComponentAdapterFactory().createComponentAdapter(Touchable.class, SimpleTouchable.class, null); 28 29 Object comp = componentAdapter.getComponentInstance(new DefaultPicoContainer()); 30 assertNotNull(comp); 31 assertTrue(comp instanceof SimpleTouchable); 32 } 33 34 public void testSingleUsecanBeInstantiatedByDefaultComponentAdapter() { 35 ComponentAdapter componentAdapter = createComponentAdapterFactory().createComponentAdapter("o", Object .class, null); 36 Object component = componentAdapter.getComponentInstance(new DefaultPicoContainer()); 37 assertNotNull(component); 38 } 39 } 40 | Popular Tags |