* @throws Exception
*/
@Test
public void testFactory() throws Exception
{
SpringBeanLocator locator = null;
Object proxy = null;
Field field = obj.getClass().getDeclaredField("nobean");
proxy = factory.getFieldValue(field, obj);
assertNull(proxy);
field = obj.getClass().getDeclaredField("beanByClass");
proxy = factory.getFieldValue(field, obj);
locator = (SpringBeanLocator)((ILazyInitProxy)proxy).getObjectLocator();
assertTrue(locator.getBeanType().equals(Bean.class));
assertTrue(locator.getSpringContextLocator() == mockCtxLocator);
assertTrue(factory.getFieldValue(field, obj) instanceof ILazyInitProxy);
field = obj.getClass().getDeclaredField("beanByName");
proxy = factory.getFieldValue(field, obj);
locator = (SpringBeanLocator)((ILazyInitProxy)proxy).getObjectLocator();
assertTrue(locator.getBeanName().equals("somebean"));
assertTrue(locator.getBeanType().equals(Bean2.class));
assertTrue(locator.getSpringContextLocator() == mockCtxLocator);
assertTrue(factory.getFieldValue(field, obj) instanceof ILazyInitProxy);
}