コード例 #1
0
 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());
 }
コード例 #2
0
 /** @throws Exception */
 public void testBindWarning() throws Exception {
   BeanDesc beanDesc = BeanDescFactory.getBeanDesc(A.class);
   PropertyDesc propDesc = beanDesc.getPropertyDesc("hoge");
   S2Container container = new S2ContainerImpl();
   ComponentDefImpl cd = new ComponentDefImpl(A.class);
   PropertyDef propDef = new PropertyDefImpl("hoge");
   cd.addPropertyDef(propDef);
   container.register(cd);
   A a = new A();
   BindingTypeDefFactory.MAY.bind(cd, propDef, propDesc, a);
 }