FileDocCategorySizeDatePackage
ServletContextHolderListenerTest.javaAPI DocExample1807Mon Jul 23 13:26:12 BST 2007org.apache.struts2.portlet.context

ServletContextHolderListenerTest

public class ServletContextHolderListenerTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
public voidtestContextInitialized()

        MockControl mockContext = MockControl.createNiceControl(ServletContext.class);
        ServletContext context = (ServletContext)mockContext.getMock();
        ServletContextEvent event = new ServletContextEvent(context);
        ServletContextHolderListener listener = new ServletContextHolderListener();
        listener.contextInitialized(event);
        assertSame(ServletContextHolderListener.getServletContext(), context);

        listener.contextDestroyed(event);
        assertNull(ServletContextHolderListener.getServletContext());