SE450: Patterns: Command Example [7/22] ![]() ![]() ![]() |
Participants and Collaborators
public interface Test {
/**
* Runs a test and collects its result in a TestResult instance.
*/
public abstract void run(TestResult result);
}
public abstract class TestCase extends Assert implements Test {
/**
* Runs the test case and collects the results in TestResult.
*/
public void run(TestResult result) {
result.run(this);
}
}
public class TestRunner extends BaseTestRunner {
public TestResult doRun(Test suite, boolean wait) {
TestResult result= createTestResult();
result.addListener(fPrinter);
long startTime= System.currentTimeMillis();
suite.run(result);
long endTime= System.currentTimeMillis();
long runTime= endTime-startTime;
fPrinter.print(result, runTime);
pause(wait);
return result;
}
}