01: package com.mockrunner.base;
02:
03: import junit.framework.TestCase;
04:
05: /**
06: * Delegator for {@link WebTestModule}. The corresponding
07: * adapters extend this class. This class is used for the basic
08: * adapter versions.
09: */
10: public abstract class BasicWebTestCase extends TestCase {
11: public BasicWebTestCase() {
12:
13: }
14:
15: public BasicWebTestCase(String arg0) {
16: super (arg0);
17: }
18:
19: /**
20: * Implemented by concrete subclasses.
21: */
22: protected abstract WebTestModule getWebTestModule();
23:
24: /**
25: * Delegates to {@link WebTestModule#addRequestParameter(String)}
26: */
27: protected void addRequestParameter(String key) {
28: getWebTestModule().addRequestParameter(key);
29: }
30:
31: /**
32: * Delegates to {@link WebTestModule#addRequestParameter(String, String)}
33: */
34: protected void addRequestParameter(String key, String value) {
35: getWebTestModule().addRequestParameter(key, value);
36: }
37:
38: /**
39: * Delegates to {@link WebTestModule#addRequestParameter(String, String[])}
40: */
41: protected void addRequestParameter(String key, String[] values) {
42: getWebTestModule().addRequestParameter(key, values);
43: }
44:
45: /**
46: * Delegates to {@link WebTestModule#getRequestParameter(String)}
47: */
48: protected String getRequestParameter(String key) {
49: return getWebTestModule().getRequestParameter(key);
50: }
51:
52: /**
53: * Delegates to {@link WebTestModule#getRequestAttribute(String)}
54: */
55: protected Object getRequestAttribute(String key) {
56: return getWebTestModule().getRequestAttribute(key);
57: }
58:
59: /**
60: * Delegates to {@link WebTestModule#setRequestAttribute(String, Object)}
61: */
62: protected void setRequestAttribute(String key, Object value) {
63: getWebTestModule().setRequestAttribute(key, value);
64: }
65:
66: /**
67: * Delegates to {@link WebTestModule#setRequestAttribute(String, Object)}
68: */
69: protected Object getSessionAttribute(String key) {
70: return getWebTestModule().getSessionAttribute(key);
71: }
72:
73: /**
74: * Delegates to {@link WebTestModule#setSessionAttribute(String, Object)}
75: */
76: protected void setSessionAttribute(String key, Object value) {
77: getWebTestModule().setSessionAttribute(key, value);
78: }
79: }
|