public void testRefToSingleton() throws Exception {
   InputStream is = getClass().getResourceAsStream("reftypes.xml");
   XmlBeanFactory xbf = new XmlBeanFactory(is);
   assertTrue(
       "6 beans in reftypes, not " + xbf.getBeanDefinitionCount(),
       xbf.getBeanDefinitionCount() == 6);
   TestBean jen = (TestBean) xbf.getBean("jenny");
   TestBean dave = (TestBean) xbf.getBean("david");
   TestBean jenks = (TestBean) xbf.getBean("jenks");
   ITestBean davesJen = dave.getSpouse();
   ITestBean jenksJen = jenks.getSpouse();
   assertTrue("1 jen instances", davesJen == jenksJen);
 }
 /** Uses a separate factory */
 public void testRefToSeparatePrototypeInstances() throws Exception {
   InputStream is = getClass().getResourceAsStream("reftypes.xml");
   XmlBeanFactory xbf = new XmlBeanFactory(is);
   assertTrue(
       "6 beans in reftypes, not " + xbf.getBeanDefinitionCount(),
       xbf.getBeanDefinitionCount() == 6);
   TestBean emma = (TestBean) xbf.getBean("emma");
   TestBean georgia = (TestBean) xbf.getBean("georgia");
   ITestBean emmasJenks = emma.getSpouse();
   ITestBean georgiasJenks = georgia.getSpouse();
   assertTrue(
       "Emma and georgia think they have a different boyfriend", emmasJenks != georgiasJenks);
   assertTrue("Emmas jenks has right name", emmasJenks.getName().equals("Andrew"));
   assertTrue("Emmas doesn't equal new ref", emmasJenks != xbf.getBean("jenks"));
   assertTrue("Georgias jenks has right name", emmasJenks.getName().equals("Andrew"));
   assertTrue("They are object equal", emmasJenks.equals(georgiasJenks));
   assertTrue("They object equal direct ref", emmasJenks.equals(xbf.getBean("jenks")));
 }