01: package test.org.jreform;
02:
03: import junit.framework.TestCase;
04:
05: import org.jreform.internal.BaseHtmlForm;
06:
07: import test.util.HttpServletRequestStub;
08:
09: abstract class BaseTestCase extends TestCase {
10: private HttpServletRequestStub req;
11:
12: protected final void setUp() throws Exception {
13: req = new HttpServletRequestStub();
14: init();
15: }
16:
17: protected abstract BaseHtmlForm getForm();
18:
19: protected void init() {
20: }
21:
22: protected void destroy() {
23: }
24:
25: protected boolean validateForm() {
26: return getForm().validate(req) && getForm().isValid();
27: }
28:
29: protected void setParameter(String key, String value) {
30: req.setParameter(key, value);
31: }
32:
33: protected void setParameters(String key, String[] values) {
34: req.setParameterValues(key, values);
35: }
36:
37: }
|