|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /proc/self/root/usr/share/junit/tests/framework/ |
Upload File : |
package junit.tests.framework;
import junit.framework.*;
/**
* Test an implementor of junit.framework.Test other than TestCase or TestSuite
*/
public class TestImplementorTest extends TestCase {
public static class DoubleTestCase implements Test {
private TestCase fTestCase;
public DoubleTestCase(TestCase testCase) {
fTestCase= testCase;
}
public int countTestCases() {
return 2;
}
public void run(TestResult result) {
result.startTest(this);
Protectable p= new Protectable() {
public void protect() throws Throwable {
fTestCase.runBare();
fTestCase.runBare();
}
};
result.runProtected(this, p);
result.endTest(this);
}
}
private DoubleTestCase fTest;
public TestImplementorTest() {
TestCase testCase= new TestCase() {
public void runTest() {
}
};
fTest= new DoubleTestCase(testCase);
}
public void testSuccessfulRun() {
TestResult result= new TestResult();
fTest.run(result);
assertEquals(fTest.countTestCases(), result.runCount());
assertEquals(0, result.errorCount());
assertEquals(0, result.failureCount());
}
}