@Test
public void testInDialog() throws Exception {
tester.startPage(new FormTestPage(new ComponentBuilder() {
public Component buildComponent(String id) {
return new GeoServerDialog(id);
}
}));
tester.assertRenderedPage(FormTestPage.class);
tester.debugComponentTrees();
GeoServerDialog dialog = (GeoServerDialog) tester.getComponentFromLastRenderedPage("form:panel");
assertNotNull(dialog);
dialog.showOkCancel(new AjaxRequestTarget(tester.getLastRenderedPage()),
new DialogDelegate() {
@Override
protected Component getContents(String id) {
return new GeoServerFileChooser(id, new Model(root));
}
@Override
protected boolean onSubmit(AjaxRequestTarget target, Component contents) {
assertNotNull(contents);
assertTrue(contents instanceof GeoServerFileChooser);
return true;
}
});
dialog.submit(new AjaxRequestTarget(tester.getLastRenderedPage()));
}