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