Reputation: 6528
I have web application that is behind a proxy. If the user has logged in, an http-header is set. I have a page that checks the header, to make sure the user isn't logged in. How can I add the header to the MockHttpRequest
generated by WicketTester?
My current unit test looks like the following:
public void testLoggedinViaProxy()
{
wt.destroy();
wt = new WicketTester(new AbstractApplicationHelper());
wt.setupRequestAndResponse();
wt.getServletRequest().addHeader("myheader", "someValue");
wt.createRequestCycle();
cl=(CSSDLogin)wt.startPage(CSSDLogin.class);
wt.assertRenderedPage(AppBasePageHelper.class);
}
UPDATE: I'm using 1.4.17 in a production website. I don't intend on upgrading to 1.5.X until it's a full release out of the Release Candidate/Milestone Stages.
the call to wt.setupRequestAndResponse();
was an attempted fix for Wicket-1215
which I found from How Do you Set A Custom Session when unit-testing with-Wicket?
Upvotes: 0
Views: 748
Reputation: 17503
I see you use Wicket 1.4. In 1.5 there is org.apache.wicket.util.tester.BaseWicketTester.addRequestHeader(String, String).
Upvotes: 0