I'm using ww2 and would like to test a LoginAction class that I have written. The action requires the client IP address. I access it in the Action by calling ServletActionContext.getRequest().getRemoteAddr().
I am very new to ww and would appreciate any guidance on the easiest / best way to handle testing this sort of thing (I.e when you access the javax.servlet objects in an action).
My current thoughts are:
1/ change my action so that the IP address is populated by an interceptor. This makes the action very easy to test - I just set the IP address into the action and call execute().
If I did this, I would have to cast my action within the interceptor to be of type LoginAction. Is this a normal thing to do? This creates a very strong coupling between the interceptor and action, and I would really prefer to keep all interceptors and actions independent.
2/ I could use a mock of the HttpServletRequest class and set it into the ServletActionContext before running LoginAction.execute(). What are other people using for this? I expect that mockobjects provides help for this - I have never used it though.
Thanks, Joel
_________________________________________________________________
Protect your inbox from harmful viruses with new ninemsn Premium. Click here http://ninemsn.com.au/premium/landing.asp
------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
