public void testGetComponentForProperyDef() throws Exception { S2Container container = new S2ContainerImpl(); ComponentDefImpl cd = new ComponentDefImpl(A2.class); cd.addPropertyDef(new PropertyDefImpl("hoge", new B())); container.register(cd); A2 a2 = (A2) container.getComponent(A2.class); assertEquals("1", "B", a2.getHogeName()); }
public void testGetComponentForType2() throws Exception { S2Container container = new S2ContainerImpl(); ComponentDefImpl cd = new ComponentDefImpl(A2.class); container.register(cd); container.register(B.class); A2 a2 = (A2) container.getComponent(A2.class); assertEquals("1", "B", a2.getHogeName()); }
public void testCyclicReference() throws Exception { S2Container container = new S2ContainerImpl(); container.register(A2.class); container.register(C.class); A2 a2 = (A2) container.getComponent(A2.class); C c = (C) container.getComponent(C.class); assertEquals("1", "C", a2.getHogeName()); assertEquals("1", "C", c.getHogeName()); }