@Test public void testAutowireNo() { GenericApplicationContext context = new GenericApplicationContext(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context); reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultAutowireNoTests.xml"); context.refresh(); DefaultsTestBean bean = (DefaultsTestBean) context.getBean(TEST_BEAN_NAME); assertNull("no dependencies should have been autowired", bean.getConstructorDependency()); assertNull("no dependencies should have been autowired", bean.getPropertyDependency1()); assertNull("no dependencies should have been autowired", bean.getPropertyDependency2()); }
@Test public void testDefaultInitAndDestroyMethodsDefined() { GenericApplicationContext context = new GenericApplicationContext(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(context); reader.loadBeanDefinitions(LOCATION_PREFIX + "defaultInitAndDestroyMethodsTests.xml"); context.refresh(); DefaultsTestBean bean = (DefaultsTestBean) context.getBean(TEST_BEAN_NAME); assertTrue("bean should have been initialized", bean.isInitialized()); context.close(); assertTrue("bean should have been destroyed", bean.isDestroyed()); }