• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem to initialize the request parameter of the HttpServlet from any JUnit test class

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there...
I am trying to make a JUnit for my doPost method in a class HttpGet that extends HttpServlet...
I am new with JUnit and I have already implemented the test class TestHttpGet with the method testdoPost(){}
in the test method I want to call the method doPost(), which I want to test! the problem is the method's parameters (request, response)! how can I initialize these parameters??
for ex. if I want to test just the request... I will put the response equal null and the request should be assigned a request parameter. My question is, how can I initialize the request parameter???

HttpGet tester = new HttpGet();
HttpServletRequest parameter = ???;
tester.doPost(parameter, null);

Many Thanks!
hama
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic