Added assertions.

This commit is contained in:
Shubham Aggarwal 2016-11-16 08:29:47 +05:30
parent 40841f93e5
commit 89ebafc9a6
1 changed files with 2 additions and 7 deletions

View File

@ -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);
} }
} }