public void testSessionActiveAndRequired() throws Exception
{
Object[] parameters = new Object[0];
IRequestCycle cycle = newCycle();
IPage page = newPage();
IDirect d = newDirect(false);
LinkFactory lf = newLinkFactory();
ResponseRenderer rr = newResponseRenderer();
trainGetParameter(cycle, ServiceConstants.COMPONENT, "fred.barney");
trainGetParameter(cycle, ServiceConstants.CONTAINER, null);
trainGetParameter(cycle, ServiceConstants.PAGE, "ActivePage");
trainGetParameter(cycle, ServiceConstants.SESSION, "T");
trainGetPage(cycle, "ActivePage", page);
cycle.activate(page);
trainGetNestedComponent(page, "fred.barney", d);
trainIsStateful(d, true);
WebSession session = newMock(WebSession.class);
WebRequest request = newWebRequest(session);
expect(session.isNew()).andReturn(false);
trainExtractListenerParameters(lf, cycle, parameters);
expect(cycle.getParameter(BrowserEvent.NAME)).andReturn(null);
cycle.setListenerParameters(parameters);
d.trigger(cycle);
rr.renderResponse(cycle);
replay();