Added assertions.
This commit is contained in:
parent
40841f93e5
commit
89ebafc9a6
|
@ -11,21 +11,16 @@ import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class BeanFactoryWithClassPathResource {
|
public class BeanFactoryWithClassPathResource {
|
||||||
|
|
||||||
Resource res = new ClassPathResource("spring-app.xml");
|
|
||||||
BeanFactory factory = new XmlBeanFactory(res);
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createBeanFactory() {
|
public void createBeanFactory() {
|
||||||
|
|
||||||
|
Resource res = new ClassPathResource("spring-app.xml");
|
||||||
|
BeanFactory factory = new XmlBeanFactory(res);
|
||||||
Employee emp = (Employee) factory.getBean("employee");
|
Employee emp = (Employee) factory.getBean("employee");
|
||||||
|
|
||||||
assertFalse(factory.isSingleton("employee"));
|
assertFalse(factory.isSingleton("employee"));
|
||||||
|
|
||||||
assertTrue(factory.getBean("employee") instanceof Employee);
|
assertTrue(factory.getBean("employee") instanceof Employee);
|
||||||
|
|
||||||
assertTrue(factory.isTypeMatch("employee", Employee.class));
|
assertTrue(factory.isTypeMatch("employee", Employee.class));
|
||||||
|
|
||||||
//we have empalias as an alias for employee
|
|
||||||
assertTrue(factory.getAliases("employee").length > 0);
|
assertTrue(factory.getAliases("employee").length > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue