This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cactus question

 
Serge Adzinets
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm learning how to test with cactus and got a question.
To test my servlet I need to call it's service methods several times with different parameters. Smth like this:
public void testMyServlet() {
MyServlet myServlet = new MyServlet();
myServlet.service(request, response);
//set request params
myServlet.service(request, response);
assertEquals(...);
}
But I can't find how I can reassign parameters once given to the request in the beginXXX() method.
Any ideas?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Serge,
I don't think you can reassign the parameters, but you don't need to. Since you can have a separate beginXXX method for each testXXX method, you can set the parameters you want in each beginXXX. If you find a test needs more than one set of parameters, you can refactor it into two tests.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic