You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by James Childers <jc...@hotels.com> on 2002/12/06 15:51:08 UTC

Clearing request parameters in test method

All,

I am looking to test a tag which sets a session attribute based on a request parameter. I need to be able to test multiple requests in the same test, something like the following:

public void beginTestTwice(WebRequest wRequest) {
	wRequest.addParameter("lang", "es");
}

public void testTwiceWithSpanish() throws Exception {
	htmlTag.doStartTag();
	assertEquals("es", request.getSession().getAttribute("lang"));

	// Need to clear request parameter here, otherwise following assertion fails
	assertNull(request.getParameter("lang"));
	htmlTag.doStartTag();
	assertEquals("es", request.getSession().getAttribute("lang"));
}

The problem is that I cannot find a way to clear the request parameter either in the test method or the end method.

Thanks in advance,

-= James

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>