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