private void doTestBug51376(boolean loadOnStartUp) throws Exception {
    // Test that for a servlet that was added programmatically its
    // loadOnStartup property is honored and its init() and destroy()
    // methods are called.

    // Set up a container
    Tomcat tomcat = getTomcatInstance();

    // No file system docBase required
    Context ctx = tomcat.addContext("", null);

    // Add ServletContainerInitializer
    Bug51376SCI sci = new Bug51376SCI(loadOnStartUp);
    ctx.addServletContainerInitializer(sci, null);

    // Start the context
    tomcat.start();

    // Stop the context
    ctx.stop();

    // Make sure that init() and destroy() were called correctly
    assertTrue(sci.getServlet().isOk());
    assertTrue(loadOnStartUp == sci.getServlet().isInitCalled());
  }
  private void doTestBug51376(boolean loadOnStartUp) throws Exception {

    // Set up a container
    Tomcat tomcat = getTomcatInstance();

    // Must have a real docBase - just use temp
    File docBase = new File(System.getProperty("java.io.tmpdir"));
    Context ctx = tomcat.addContext("", docBase.getAbsolutePath());

    // Add ServletContainerInitializer
    Bug51376SCI sci = new Bug51376SCI(loadOnStartUp);
    ctx.addServletContainerInitializer(sci, null);

    // Start the context
    tomcat.start();

    // Stop the context
    ctx.stop();

    // Make sure that init() and destroy() were called correctly
    assertTrue(sci.getServlet().isOk());
  }