use of com.blade.types.BladeBeanDefineType in project blade by biezhi.
the class BeanDefineTest method testBeanDefine2.
@Test
public void testBeanDefine2() {
BeanDefine beanDefine = new BeanDefine(new BladeBeanDefineType(), BladeBeanDefineType.class);
assertEquals(BladeBeanDefineType.class, beanDefine.getType());
beanDefine = new BeanDefine(new BladeBeanDefineType(), BladeBeanDefineType.class, true);
assertEquals(BladeBeanDefineType.class, beanDefine.getType());
assertEquals(true, beanDefine.isSingleton());
}
use of com.blade.types.BladeBeanDefineType in project blade by biezhi.
the class FieldInjectorTest method testFieldInjector.
@Test
public void testFieldInjector() {
Ioc ioc = new SimpleIoc();
ioc.addBean("jack");
ioc.addBean(new BladeBeanDefineType());
Field field = BladeBeanDefineType.class.getDeclaredFields()[0];
FieldInjector fieldInjector = new FieldInjector(ioc, field);
fieldInjector.injection(ioc.getBean(BladeBeanDefineType.class));
}
use of com.blade.types.BladeBeanDefineType in project blade by biezhi.
the class BeanDefineTest method testBeanDefine.
@Test
public void testBeanDefine() {
BeanDefine beanDefine = new BeanDefine(new BladeBeanDefineType());
Class<?> type = beanDefine.getType();
assertEquals(BladeBeanDefineType.class, type);
Object bean = beanDefine.getBean();
assertNotNull(bean);
assertEquals(true, beanDefine.isSingleton());
beanDefine.setSingleton(true);
beanDefine.setType(BladeBeanDefineType.class);
beanDefine.setBean(new BladeBeanDefineType());
assertEquals(BladeBeanDefineType.class, type);
assertNotNull(bean);
assertEquals(true, beanDefine.isSingleton());
}
use of com.blade.types.BladeBeanDefineType in project blade by biezhi.
the class FieldInjectorTest method testFieldInjectorError.
@Test(expected = RuntimeException.class)
public void testFieldInjectorError() {
Ioc ioc = new SimpleIoc();
FieldInjector fieldInjector = new FieldInjector(ioc, null);
fieldInjector.injection(new BladeBeanDefineType());
}
Aggregations