1 10 package org.picocontainer.defaults.issues; 11 12 import org.picocontainer.defaults.DefaultPicoContainer; 13 import org.picocontainer.defaults.VerifyingVisitor; 14 15 import junit.framework.TestCase; 16 17 18 public class Issue0229TestCase extends TestCase { 19 public static class MockRunnable implements Runnable { 20 public void run() { 21 } 22 } 23 24 public static class OtherRunnable implements Runnable { 25 public void run() { 26 } 27 } 28 29 public static class MockRunner { 30 private final Runnable [] _runners; 31 32 public MockRunner(Runnable [] runnables) { 33 _runners = runnables; 34 } 35 36 public Runnable [] getRunners(){ 37 return _runners; 38 } 39 } 40 41 public void testArrayDependenciesAndVerification() { 42 DefaultPicoContainer container = new DefaultPicoContainer(); 43 container.registerComponentImplementation(MockRunnable.class); 44 container.registerComponentImplementation(OtherRunnable.class); 45 container.registerComponentImplementation(MockRunner.class); 46 47 VerifyingVisitor visitor = new VerifyingVisitor(); 49 visitor.traverse(container); 50 51 container.start(); 52 assertNotNull(container.getComponentInstanceOfType(MockRunner.class)); 53 } 54 55 } 56 | Popular Tags |