01: package test.org.jreform;
02:
03: import org.jreform.HtmlForm;
04: import org.jreform.UndefinedInputControlException;
05:
06: public class FormTest extends BaseTestCase {
07: private static final String STRING_INPUT = "StringInput";
08: private static final String INT_INPUT = "intInput";
09: private static final String INT_MULTI_INPUT = "intMultiInput";
10:
11: private TestForm form;
12:
13: protected void init() {
14: form = new TestForm();
15: }
16:
17: protected HtmlForm getForm() {
18: return form;
19: }
20:
21: public void testGetInputThatDoesNotExistThrowsException() {
22: try {
23: form.getInput("input doesn't exist");
24: fail("Error - exception expected");
25: } catch (UndefinedInputControlException e) {
26: }
27: }
28:
29: private static class TestForm extends HtmlForm {
30: public TestForm() {
31: input(stringType(), STRING_INPUT).optional();
32: input(intType(), INT_INPUT).optional();
33: multiCheckbox(intType(), INT_MULTI_INPUT).optional();
34: }
35: }
36:
37: }
|