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 Matt Raible <ma...@raibledesigns.com> on 2002/12/11 22:12:05 UTC
Setting up request correctly
I have a servlet named LoginServlet that is mapped to the path /auth.
When I test this servlet, do I have to do anything additional to get
this path requested and set the request port, scheme and all that
correctly? I'm getting a NullPointerException when trying to retrieve
these values. At least I think I am, maybe some debugging would help -
just wanted to do a quick check.
Here's my test methods:
public void beingExecute(WebRequest wRequest) {
wRequest.addParameter("j_username", "tomcat");
wRequest.addParameter("j_password", "tomcat");
}
/**
* Test logging in as user a user
* @throws Exception
*/
public void testExecute() throws Exception {
servlet.execute(request, response);
// verify user object placed into session
assertTrue(request.getSession().getAttribute(Constants.USER_KEY) !=
null);
}
Thanks,
Matt