Is that really the way to do it? The startPanel already creates a dummy page for us, but without any page parameters. Using your approach attaches the panel to two pages, which does not seem like the optimal solution to me. Right now I extended the WicketTester with a startPanel(Panel, PageParameters) function:
public Panel startPanel(final TestPanelSource testPanelSource, final PageParameters parameters) {
return (Panel) startPage(new ITestPageSource() {
public Page getTestPage() {
return new DummyPanelPage(testPanelSource, parameters);
}
}).get(DummyPanelPage.TEST_PANEL_ID);
}
And created a new dummy panel page with a page parameters constrctor
public class DummyPanelPage extends WebPage {
/**
* The dummy <code>Panel</code> <code>Component</code> id.
*/
public static final String TEST_PANEL_ID = "panel";
/**
* Default constructor.
* @param testPanelSource <code>TestPanelSource</code>
*/
public DummyPanelPage(final TestPanelSource testPanelSource, final PageParameters parameters) {
super(parameters);
add(testPanelSource.getTestPanel(TEST_PANEL_ID));
}
}
It beats me why this functionality isn't just provided out of the box by Apache.