How do you set a custom session when unit testing with wicket?
Posted
by vagabond
on Stack Overflow
See other posts from Stack Overflow
or by vagabond
Published on 2010-03-16T17:53:44Z
Indexed on
2010/03/17
1:11 UTC
Read the original article
Hit count: 389
I'm trying to run some unit tests on a wicket page that only allows access after you've logged in. In my JUnit test I cannot start the page or render it without setting the session.
How do you set the session? I'm having problems finding any documentation on how to do this.
WicketTester tester = new WicketTester(new MyApp());
((MyCustomSession)tester.getWicketSession()).setItem(MyFactory.getItem("abc"));
//Fails to start below, no session seems to be set
tester.startPage(General.class);
tester.assertRenderedPage(General.class);
© Stack Overflow or respective owner