File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getRemoteAddr

 
Rowan Chattaway
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm implementing the StrutsTestCase into my current project to provide a suite of JUnit tests for the core Struts actions.

However, the ProcessLoginAction implements ipaddress checking for screening of dubious users. This uses HttpServletrequest.getRemoteAddr().

For my JUnit test - because it's run within my IDE and therefore outside the servlet container, this isn't set and returns null. Because of this the struts action forwards to failure.

Obvioulsy I don't want to change to project code to suit the test.
Can I set remoteAddr someway? or get around this?

Any help would be much appreciated.
Thanks.
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can always decorate it yourself .. or use some mock object framework. Fun stuff.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic