Hi all,
I have a panel that redirects to another page if the user isn't logged
in, e.g
public MyPanel(String id) {
super(id);
Integer accountId = sessionBean.getAccountId();
if (accountId == null) { // not logged in, redirect to login
getRequestCycle().setRedirect(true);
setResponsePage(LoginPage.class, new PageParameters("siteId=" +
sessionBean.getSiteId()));
return;
}
... do normal panel display
}
I naively setup my test like this:
tester.startPanel(new ITestPanelSource() {
@Override
public Panel getTestPanel(String panelId) {
return new MyPanel(panelId);
}
});
tester.assertRenderedPage(LoginPage.class);
but I get:
- Redirecting to /BaseTestCase$1/BaseTestCase$1/?wicket:interface=:1::::
- Unable to find component with id 'welcome' in [MarkupContainer
[Component id = panel]]. This means that you declared wicket:id=welcome
in your markup, but that you either did not add the component to your
page at all, or that the hierarchy does not match.
[markup = file:/home/Developer/build/component/page/account/MyPanel.html
I see that redirect is logged by Wicket, but
WicketTester still tries to render MyPanel, when it shouldn't...
is there a way to work around this issue?
Sincerely,
Alexander
P.S. testing with enclosing page, e.g. tester.startPage(new MyPage(new
PageParameters())); produces the same error
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org