tester.assertModelValue("form:panel:defaultStyle", target);
}
public void testNew() {
final LayerInfo layer = getCatalog().getFactory().createLayer();
FormTestPage page = new FormTestPage(new ComponentBuilder() {
public Component buildComponent(String id) {
return new WMSLayerConfig(id, new Model(layer));
}
}
);
Component layerConfig = page.get("form:panel:defaultStyle");
tester.startPage(page);
tester.assertRenderedPage(FormTestPage.class);
tester.assertComponent("form", Form.class);
tester.assertComponent("form:panel:defaultStyle", DropDownChoice.class);
// check submitting like this will create errors, there is no selection
tester.submitForm("form");
assertTrue(page.getSession().getFeedbackMessages().hasErrorMessageFor(layerConfig));
// now set something and check there are no messages this time
page.getSession().getFeedbackMessages().clear();
FormTester ft = tester.newFormTester("form");
ft.select("panel:defaultStyle", 0);
ft.submit();
assertFalse(page.getSession().getFeedbackMessages().hasErrorMessageFor(layerConfig));
}