The constructor of the wickettesters calls createRequestCycle()
that tries to find a session and 1 will be created or not.
But that session won't be binded yet. That is done in the
setupRequestAndResponse()

But setupRequestAndResponse first calls again createRequestCycle and then
the first one is not binded yet.

what we could do is not call createRequestCycle in the constructor of wicket
tester but setupRequestAndResponse
i don't know what draw backs that would have.

johan



On Dec 8, 2007 3:59 PM, Martijn Dashorst <[EMAIL PROTECTED]> wrote:

> While working on the final chapter of WIA I am writing about testing with
> WicketTester.
> I have the following example:
>
>
> @Test public void labelContainsHelloWorldInFrench() {
>
>    WicketTester tester = new WicketTester();
>
>    tester.setupRequestAndResponse(); #1
>
>    tester.getWicketSession().setLocale(Locale.FRENCH); #2
>
>    tester.startPage(HelloWorld.class);
>
>    tester.assertLabel("message", "Bonjour tout le monde!");
>
> }
>
> Why is the tester.setupRequestAndResponse() call necessary (#1)? If I
> don't
> call it, #2 will set the locale on a different session.
>
> Martijn
>
> --
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0-rc1 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-rc1/
>

Reply via email to