package net.sf.springofeclipse.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import net.sf.springofeclipse.BeansExtensionPointBeanDefinitionReader;
import net.sf.springofeclipse.tests.stubs.TestBean;
import org.junit.Test;
import org.springframework.context.support.GenericApplicationContext;
public class BeansExtensionPointBeanDefinitionReaderTest {
@Test
public void testLoadBeanDefinitions() throws Throwable {
GenericApplicationContext context = new GenericApplicationContext();
context.setId("testContext");
BeansExtensionPointBeanDefinitionReader reader = new BeansExtensionPointBeanDefinitionReader(
context);
reader.loadBeanDefinitions(context.getId());
TestBean bean = (TestBean) context.getBean("testBean", TestBean.class);
assertNotNull(bean);
assertEquals(context.getBean("testBean2"), bean.getTestBeanProperty());
assertEquals(-5, bean.getIntProperty());
assertNotNull(bean.getPropsProperty());
assertEquals("2", bean.getPropsProperty().getProperty("b"));
TestBean bean3 = (TestBean) context
.getBean("testBean3", TestBean.class);
assertNotNull(bean3);
assertEquals(58, bean3.getIntProperty());
}
}