fix tests
This commit is contained in:
@@ -13,11 +13,11 @@ public class BeanFactoryWithClassPathResourceTest {
|
||||
|
||||
@Test
|
||||
public void createBeanFactoryAndCheckEmployeeBean() {
|
||||
Resource res = new ClassPathResource("spring-app.xml");
|
||||
Resource res = new ClassPathResource("beanfactory-example.xml");
|
||||
BeanFactory factory = new XmlBeanFactory(res);
|
||||
Employee emp = (Employee) factory.getBean("employee");
|
||||
|
||||
assertFalse(factory.isSingleton("employee"));
|
||||
assertTrue(factory.isSingleton("employee"));
|
||||
assertTrue(factory.getBean("employee") instanceof Employee);
|
||||
assertTrue(factory.isTypeMatch("employee", Employee.class));
|
||||
assertTrue(factory.getAliases("employee").length > 0);
|
||||
|
||||
13
spring-core/src/test/resources/beanfactory-example.xml
Normal file
13
spring-core/src/test/resources/beanfactory-example.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
|
||||
|
||||
<bean id="employee" class="com.baeldung.beanfactory.Employee">
|
||||
<constructor-arg name="name" value="Hello! My name is Java"/>
|
||||
<constructor-arg name="age" value="18"/>
|
||||
</bean>
|
||||
|
||||
<alias name="employee" alias="empalias" />
|
||||
</beans>
|
||||
Reference in New Issue
Block a user