public void testGetInstanceWithMistypedBeanFactoryClassFails() throws BeansException {
    System.setProperties(null);
    Properties p = new Properties();
    p.put(BeanFactoryBootstrap.BEAN_FACTORY_BEAN_NAME + ".class", "java.awt.Point");

    System.setProperties(p);
    BeanFactoryBootstrap.reinitialize();
    try {
      BeanFactoryBootstrap bsb = BeanFactoryBootstrap.getInstance();
      fail("Should have failed with mistyped class");
    } catch (BootstrapException ex) {
      // OK
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  public void testGetInstanceWithUnknownBeanFactoryClassFails() throws BeansException {
    System.setProperties(null);
    Properties p = new Properties();
    p.put(
        BeanFactoryBootstrap.BEAN_FACTORY_BEAN_NAME + ".class",
        "org.springframework.beans.factory.support.xxxxXmlBeanFactory");

    System.setProperties(p);
    BeanFactoryBootstrap.reinitialize();
    try {
      BeanFactoryBootstrap bsb = BeanFactoryBootstrap.getInstance();
      fail("Should have failed with invalid class");
    } catch (BootstrapException ex) {
      // OK
    }
  }
  public void testDummyBeanFactory() throws Exception {
    Properties p = new Properties();
    p.put(
        BeanFactoryBootstrap.BEAN_FACTORY_BEAN_NAME + ".class",
        "org.springframework.beans.factory.access.BeanFactoryBootstrapTests$DummyBeanFactory");

    System.setProperties(p);
    System.getProperties().list(System.out);

    BeanFactoryBootstrap.reinitialize();

    try {
      BeanFactoryBootstrap bsb = BeanFactoryBootstrap.getInstance();
      System.out.println("Got bean factory");
      assertNotNull("Bsb instance is not null", bsb);
      assertTrue("Is dummy", bsb.getBeanFactory() instanceof DummyBeanFactory);
      TestBean tb = (TestBean) bsb.getBeanFactory().getBean("test");
      assertNotNull("Test bean is not null", tb);
      System.out.println(tb);
      // assertTrue("Property set", tb.getFoo().equals("bar"));
    } catch (Exception ex) {
      ex.printStackTrace();
      throw ex;
    }
  }
 /** How to test many singletons? */
 public void testGetInstanceWithNullPropertiesFails() throws BeansException {
   System.setProperties(null);
   BeanFactoryBootstrap.reinitialize();
   try {
     BeanFactoryBootstrap bsb = BeanFactoryBootstrap.getInstance();
     fail("Should have failed with no system properties");
   } catch (BootstrapException ex) {
     // OK
   }
 }