public XmlBeanFactoryTestSuite() {
    parent = new ListableBeanFactoryImpl();
    Map m = new HashMap();
    m.put("name", "Albert");
    parent.registerBeanDefinition(
        "father", new RootBeanDefinition(TestBean.class, new MutablePropertyValues(m), true));
    m = new HashMap();
    m.put("name", "Roderick");
    parent.registerBeanDefinition(
        "rod", new RootBeanDefinition(TestBean.class, new MutablePropertyValues(m), true));

    // Load from classpath, NOT a file path
    InputStream is = getClass().getResourceAsStream("test.xml");
    this.factory = new XmlBeanFactory(is, parent);
    this.factory.preInstantiateSingletons();
  }
  public void testFactoryNesting() {
    ITestBean father = (ITestBean) getBeanFactory().getBean("father");
    assertTrue("Bean from root context", father != null);

    ITestBean rod = (ITestBean) getBeanFactory().getBean("rod");
    assertTrue("Bean from child context", "Rod".equals(rod.getName()));
    assertTrue("Bean has external reference", rod.getSpouse() == father);

    rod = (ITestBean) parent.getBean("rod");
    assertTrue("Bean from root context", "Roderick".equals(rod.getName()));
  }