The session object is a simple Map, so creating it is easy.
First, you have to define an instance variable in which to store the
session, and second, you need to implement the setSession() method.
public class MyAction implements SessionAware {
private Map session;
public void setSessi
Thanks for the tip, but I'll need an actual code snippet, because when I make
my action implement SessionAware, I need to also implement the setSession()
method, and I'm back to square 1, trying to figure out how to create a session
object. I can send a HashMap to the method, but what does it h
If your Action implements SessionAware, you don't need to make a mock
HttpSession at all. You just make a new HashMap, stuff it with the
values you want, and call action.setSession(). Just one more of the
things I love about Struts 2. :)
But there are libraries around that do allow mock Htt
Spring has a MockHttpSession, or perhaps you could use
jMock?
d.
--- Session A Mwamufiya <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> How do I go about creating a dummy HttpSession
> object for unit testing a struts 2 app?
>
> I have created a dummy HttpServletRequest object,
> but I can't instanciate
Hi,
How do I go about creating a dummy HttpSession object for unit testing a struts
2 app?
I have created a dummy HttpServletRequest object, but I can't instanciate an
HttpSession in teh Request.getSession() method, because HttpSession is an
abstract interface and I can't create an instance of
5 matches
Mail list logo