KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > junit > extensions > TestDecorator


1 package junit.extensions;
2
3 import junit.framework.Assert;
4 import junit.framework.Test;
5 import junit.framework.TestResult;
6
7 /**
8  * A Decorator for Tests. Use TestDecorator as the base class for defining new
9  * test decorators. Test decorator subclasses can be introduced to add behaviour
10  * before or after a test is run.
11  *
12  */

13 public class TestDecorator extends Assert implements Test {
14     protected Test fTest;
15
16     public TestDecorator(Test test) {
17         fTest= test;
18     }
19
20     /**
21      * The basic run behaviour.
22      */

23     public void basicRun(TestResult result) {
24         fTest.run(result);
25     }
26
27     public int countTestCases() {
28         return fTest.countTestCases();
29     }
30
31     public void run(TestResult result) {
32         basicRun(result);
33     }
34
35     @Override JavaDoc
36     public String JavaDoc toString() {
37         return fTest.toString();
38     }
39
40     public Test getTest() {
41         return fTest;
42     }
43 }
Popular Tags