public void testGetComponentForAspectDef() throws Exception { S2Container container = new S2ContainerImpl(); ComponentDefImpl cd = new ComponentDefImpl(A.class); cd.addAspectDef(new AspectDefImpl(new TraceInterceptor())); container.register(cd); container.register(B.class); A a = (A) container.getComponent(A.class); assertEquals("1", "B", a.getHogeName()); }
public void testGetComponentForType3() throws Exception { S2Container container = new S2ContainerImpl(); ComponentDefImpl cd = new ComponentDefImpl(A.class); container.register(cd); container.register(B.class); A a = (A) container.getComponent(A.class); assertEquals("1", "B", a.getHogeName()); assertSame("2", a, container.getComponent(A.class)); }