Hi Lukasz, + actionContext.setSession(new HashMap<String, Object>());
what about setting session at a lower level (I didn't test though): request.setSession(new MockHttpSession(servletContext)); On 10 April 2012 21:33, <lukaszlen...@apache.org> wrote: > Author: lukaszlenart > Date: Tue Apr 10 19:33:51 2012 > New Revision: 1311951 > > URL: http://svn.apache.org/viewvc?rev=1311951&view=rev > Log: > WW-3442 adds Session initialisation method to solve problem with missing > session and allow to initialise session on its own in test cases > > Modified: > > > struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java > > Modified: > struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java > URL: > http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java?rev=1311951&r1=1311950&r2=1311951&view=diff > > ============================================================================== > --- > struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java > (original) > +++ > struts/struts2/trunk/plugins/junit/src/main/java/org/apache/struts2/StrutsTestCase.java > Tue Apr 10 19:33:51 2012 > @@ -149,17 +149,23 @@ public abstract class StrutsTestCase ext > return proxy; > } > > - private void initActionContext(ActionContext actionContext) { > - actionContext.setParameters(new > HashMap(request.getParameterMap())); > - > - initMockPortletContext(actionContext); > + protected void initActionContext(ActionContext actionContext) { > + actionContext.setParameters(new HashMap<String, > Object>(request.getParameterMap())); > + initSession(actionContext); > + initPortletContext(actionContext); > applyAdditionalParams(actionContext); > - > // set the action context to the one used by the proxy > ActionContext.setContext(actionContext); > } > > - private void initMockPortletContext(ActionContext actionContext) { > + protected void initSession(ActionContext actionContext) { > + Map<String, Object> session = actionContext.getSession(); > + if (session == null) { > + } > + } > + > + protected void initPortletContext(ActionContext actionContext) { > try { > ClassLoaderUtil.loadClass("javax.portlet.PortletContext", > getClass()); > Class mockClazz = > ClassLoaderUtil.loadClass("org.springframework.mock.web.portlet.MockPortletContext", > getClass()); > > >