001: /*
002: * ========================================================================
003: *
004: * Copyright 2001-2004 The Apache Software Foundation.
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: *
018: * ========================================================================
019: */
020: package org.apache.cactus.internal;
021:
022: import java.net.HttpURLConnection;
023:
024: import org.apache.cactus.WebRequest;
025: import org.apache.cactus.WebResponse;
026:
027: /**
028: * Unit tests of the {@link AbstractCactusTestCase} class.
029: *
030: * @version $Id: TestAbstractCactusTestCase.java 238991 2004-05-22 11:34:50Z vmassol $
031: */
032: public class TestAbstractCactusTestCase extends
033: AbstractTestAbstractCactusTestCase {
034: /**
035: * @see #testBeginMethodBadReturnType()
036: */
037: public String beginBeginMethodBadReturnType(WebRequest theRequest) {
038: // Return anything just to make the compiler happy ...
039: return "";
040: }
041:
042: /**
043: * Test that when a begin method for a given test does not have the correct
044: * return type (i.e. void), a <code>AssertionFailedError</code> exception
045: * is returned.
046: * Note: the assert is done in the
047: * <code>TestAbstractTestCaseInterceptorTestCase</code> class.
048: */
049: public void testBeginMethodBadReturnType() {
050: // This method only exist so that a test exist and thus the begin
051: // method for that test will be called.
052: // Should not reach this point
053: fail("Should not reach this point");
054: }
055:
056: //-------------------------------------------------------------------------
057:
058: /**
059: * @see #testBeginMethodNotPublic()
060: */
061: private void beginBeginMethodNotPublic(WebRequest theRequest) {
062: }
063:
064: /**
065: * Test that when a begin method for a given test is not declared public
066: * a <code>AssertionFailedError</code> exception is returned.
067: * Note: the assert is done in the
068: * <code>TestAbstractTestCaseInterceptorTestCase</code> class.
069: */
070: public void testBeginMethodNotPublic() {
071: // This method only exist so that a test exist and thus the begin
072: // method for that test will be called.
073: // Should not reach this point
074: fail("Should not reach this point");
075: }
076:
077: //-------------------------------------------------------------------------
078:
079: /**
080: * @see #testBeginMethodBadReturnType()
081: */
082: public void beginBeginMethodBadParamType(String theDummy) {
083: }
084:
085: /**
086: * Test that when a begin method for a given test has the wrong type of
087: * parameters, a <code>AssertionFailedError</code> exception is returned.
088: * Note: the assert is done in the
089: * <code>TestAbstractTestCaseInterceptorTestCase</code> class.
090: */
091: public void testBeginMethodBadParamType() {
092: // This method only exist so that a test exist and thus the begin
093: // method for that test will be called.
094: // Should not reach this point
095: fail("Should not reach this point");
096: }
097:
098: //-------------------------------------------------------------------------
099:
100: /**
101: * @see #testBeginMethodBadParamNumber()
102: */
103: public void beginBeginMethodBadParamNumber(WebRequest theRequest,
104: String theString) {
105: }
106:
107: /**
108: * Test that when a begin method for a given test has the wrong number of
109: * parameters, a <code>AssertionFailedError</code> exception is returned.
110: * Note: the assert is done in the
111: * <code>TestAbstractTestCaseInterceptorTestCase</code> class.
112: */
113: public void testBeginMethodBadParamNumber() {
114: // This method only exist so that a test exist and thus the begin
115: // method for that test will be called.
116: // Should not reach this point
117: fail("Should not reach this point");
118: }
119:
120: //-------------------------------------------------------------------------
121:
122: /**
123: * @see #testBeginMethodOK()
124: */
125: public void beginBeginMethodOK(WebRequest theRequest) {
126: // We send an exception just to verify that this code has been reached
127: // The exception is intercepted in
128: // TestAbstractTestCaseInterceptorTestCase
129: fail("beginBeginMethodOK");
130: }
131:
132: /**
133: * Verify that the begin method with a
134: * <code>WebRequest</code> parameter is called correctly.
135: */
136: public void testBeginMethodOK() {
137: }
138:
139: //-------------------------------------------------------------------------
140:
141: /**
142: * Test that when an end method for a given test does not have the correct
143: * return type (i.e. void), a <code>AssertionFailedError</code> exception
144: * is returned.
145: * Note: the assert is done in the
146: * <code>TestAbstractTestCaseInterceptorTestCase</code> class.
147: */
148: public void testEndMethodBadReturnType() {
149: // This method only exist so that a test exist and thus the begin
150: // method for that test will be called.
151: }
152:
153: /**
154: * @see #testEndMethodBadReturnType()
155: */
156: public String endEndMethodBadReturnType(WebResponse theResponse) {
157: // Return anything just to make the compiler happy ...
158: return "";
159: }
160:
161: //-------------------------------------------------------------------------
162:
163: /**
164: * Test that when an end method for a given test is not declared public
165: * a <code>AssertionFailedError</code> exception is returned.
166: * Note: the assert is done in the
167: * <code>TestAbstractTestCaseInterceptorTestCase</code> class.
168: */
169: public void testEndMethodNotPublic() {
170: }
171:
172: /**
173: * @see #testEndMethodNotPublic()
174: */
175: private void endEndMethodNotPublic(WebResponse theResponse) {
176: }
177:
178: //-------------------------------------------------------------------------
179:
180: /**
181: * Test that when an end method for a given test has the wrong type of
182: * parameters, a <code>AssertionFailedError</code> exception is returned.
183: * Note: the assert is done in the
184: * <code>TestAbstractTestCaseInterceptorTestCase</code> class.
185: */
186: public void testEndMethodBadParamType() {
187: }
188:
189: /**
190: * @see #testEndMethodBadParamType()
191: */
192: public void endEndMethodBadParamType(String theDummy) {
193: }
194:
195: //-------------------------------------------------------------------------
196:
197: /**
198: * Test that when an end method for a given test has the wrong number of
199: * parameters, a <code>AssertionFailedError</code> exception is returned.
200: * Note: the assert is done in the
201: * <code>TestAbstractTestCaseInterceptorTestCase</code> class.
202: */
203: public void testEndMethodBadParamNumber() {
204: }
205:
206: /**
207: * @see #testEndMethodBadParamNumber()
208: */
209: public void endEndMethodBadParamNumber(WebResponse theResponse,
210: String theDummy) {
211: }
212:
213: //-------------------------------------------------------------------------
214:
215: /**
216: * Test that the end method is called correctly when it's signature
217: * contains a <code>org.apache.cactus.WebResponse</code> parameter.
218: */
219: public void testEndMethodOK1() {
220: }
221:
222: /**
223: * @see #testEndMethodOK1()
224: */
225: public void endEndMethodOK1(WebResponse theResponse) {
226: // We send an exception just to verify that this code has been reached
227: // The exception is intercepted in
228: // TestAbstractTestCaseInterceptorTestCase
229: fail("endEndMethodOK1");
230: }
231:
232: //-------------------------------------------------------------------------
233:
234: /**
235: * Test that the end method is called correctly when it's signature
236: * contains a <code>com.meterware.httpunit.WebResponse</code> parameter.
237: *
238: * Note: We need the Httpunit jar and an XML parser jar on the classpath
239: * for this test
240: */
241: public void testEndMethodOK2() {
242: }
243:
244: /**
245: * @see #testEndMethodOK2()
246: */
247: public void endEndMethodOK2(
248: com.meterware.httpunit.WebResponse theResponse) {
249: // We send an exception just to verify that this code has been reached
250: // The exception is intercepted in
251: // TestAbstractTestCaseInterceptorTestCase
252: fail("endEndMethodOK2");
253: }
254:
255: //-------------------------------------------------------------------------
256:
257: /**
258: * Test that the deprecated end method with the
259: * <code>HttpURLConnection</code> parameter can still be called correctly.
260: */
261: public void testEndMethodOK3() {
262: }
263:
264: /**
265: * @see #testEndMethodOK3()
266: */
267: public void endEndMethodOK3(HttpURLConnection theResponse) {
268: // We send an exception just to verify that this code has been reached
269: // The exception is intercepted in
270: // TestAbstractTestCaseInterceptorTestCase
271: fail("endEndMethodOK3");
272: }
273: }
|