This is happening because you are executing action in @Before
method. In that way the setUp
method of StrutsJUnit4TestCase
is not getting called in between your loginAdmin
and test method and you previous request parameters are passed to it again. You can call setUp
method by yourself in your tests method.
In your case you can actually call initServletMockObjects
method to create new mock servlet objects such as request.
@Test
public void testList() throws Exception {
setUp();
// or
// initServletMockObjects();
request.setParameter("iDisplayStart", "0");
request.setParameter("iDisplayLength", "10");
String response = executeAction("/campaign/list");
System.out.println("Reponse : " + response);
}