Anonymous - 2003-12-02

I am trying to test a page navigation scenario where I want to simulate a click in a web page using ServletUnit.  When I try the same thing using a JSP instead of a servlet and a WebConversation, I am able to simulate click events without any problems.  What I would like to do is something like this.

ServletRunner servletRunner = new ServletRunner();
servletRunner.registerServlet(SERVLET_NAME, MyServlet.class.getName());

ServletUnitClient client = servletRunner.newClient();
InvocationContext ic = client.newInvocation(request);

WebRequest request = new PostMethodWebRequest(SERVLET_URL);

MyServlet s = new MyServlet();
s.service(ic.getRequest(), ic.getResponse());

WebResponse response1 = ic.getServletResponse();

WebLink myLink = response1.getLinkWithID("linkID");
//This next call will fail with a NullPointerException
WebResponse response2 = myLink.click();

Any idea about what I am doing wrong?  Is it possible achieve this?

Thanks,
Martin