Package net.sf.springofeclipse.tests

Source Code of net.sf.springofeclipse.tests.BeansExtensionPointBeanDefinitionReaderTest

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());

  }
}
TOP

Related Classes of net.sf.springofeclipse.tests.BeansExtensionPointBeanDefinitionReaderTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.