aboutsummaryrefslogtreecommitdiff
path: root/src/junit/extensions/TestDecorator.java
blob: 2111e8f5cb3cc69d4e3b1c19f20255a1af8ae188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package junit.extensions;

import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestResult;

/**
 * A Decorator for Tests. Use TestDecorator as the base class
 * for defining new test decorators. Test decorator subclasses
 * can be introduced to add behaviour before or after a test
 * is run.
 *
 */
public class TestDecorator extends Assert implements Test {
	protected Test fTest;

	public TestDecorator(Test test) {
		fTest= test;
	}
	/**
	 * The basic run behaviour.
	 */
	public void basicRun(TestResult result) {
		fTest.run(result);
	}
	public int countTestCases() {
		return fTest.countTestCases();
	}
	public void run(TestResult result) {
		basicRun(result);
	}

	public String toString() {
		return fTest.toString();
	}

	public Test getTest() {
		return fTest;
	}
}