Source code: junit/extensions/TestDecorator.java
1 package junit.extensions;
2
3 import junit.framework.*;
4
5 /**
6 * A Decorator for Tests. Use TestDecorator as the base class
7 * for defining new test decorators. Test decorator subclasses
8 * can be introduced to add behaviour before or after a test
9 * is run.
10 *
11 */
12 public class TestDecorator extends Assert implements Test {
13 protected Test fTest;
14
15 public TestDecorator(Test test) {
16 fTest= test;
17 }
18 /**
19 * The basic run behaviour.
20 */
21 public void basicRun(TestResult result) {
22 fTest.run(result);
23 }
24 public int countTestCases() {
25 return fTest.countTestCases();
26 }
27 public void run(TestResult result) {
28 basicRun(result);
29 }
30
31 public String toString() {
32 return fTest.toString();
33 }
34
35 public Test getTest() {
36 return fTest;
37 }
38 }