MockHttpSession session = new MockHttpSession();
MockHttpSession session = new MockHttpSession(servletContext);
    public void testPublisher() {        HttpSessionEventPublisher publisher = new HttpSessionEventPublisher();        StaticWebApplicationContext context = new StaticWebApplicationContext();        MockServletContext servletContext = new MockServletContext();        servletContext.setAttribute(StaticWebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);        context.setServletContext(servletContext);        context.registerSingleton("listener", TestListener.class, null);        context.refresh();        publisher.contextInitialized(new ServletContextEvent(servletContext));        MockHttpSession session = new MockHttpSession();        TestListener listener = (TestListener) context.getBean("listener");        HttpSessionEvent event = new HttpSessionEvent(session);        publisher.sessionCreated(event);        assertNotNull(listener.getCreatedEvent());        assertNull(listener.getDestroyedEvent());        assertEquals(session, listener.getCreatedEvent().getSession());        listener.setCreatedEvent(null);        listener.setDestroyedEvent(null);        publisher.sessionDestroyed(event);        assertNotNull(listener.getDestroyedEvent());        assertNull(listener.getCreatedEvent());        assertEquals(session, listener.getDestroyedEvent().getSession());        publisher.contextDestroyed(new ServletContextEvent(servletContext));    }