jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robertson, Jason" <Jason.Robert...@acs-inc.com>
Subject RE: Clearing request parameters in test method
Date Tue, 10 Dec 2002 22:20:15 GMT
ServletRequest has a removeAttribute() method, is this what you're looking
for?

   request.removeAttribute("lang");

Jason

-----Original Message-----
From: James Childers [mailto:jchilders@hotels.com]
Sent: Tuesday, December 10, 2002 4:01 PM
To: cactus-user@jakarta.apache.org
Subject: Clearing request parameters in test method


All,

Reposting this question because I haven't found an answer yet.

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:
<mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:cactus-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>


Mime
View raw message