• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

getRemoteAddr

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can always decorate it yourself .. or use some mock object framework. Fun stuff.
 
Attractive, successful people love this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic