1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.math;
18
19 import junit.framework.AssertionFailedError;
20 import junit.framework.TestCase;
21
22 /**
23 * A TestCase that retries tests when assertions fail.
24 * <p>
25 * If one or more tests throw an AssertionFailedError, all tests are
26 * repeated one time.
27 * <p>
28 * Errors or exceptions other than AssertionFailedError do not lead to retries.
29 *
30 * @version $Revision: 155427 $ $Date: 2005-02-26 06:11:52 -0700 (Sat, 26 Feb 2005) $
31 */
32 public class RetryTestCase extends TestCase {
33
34 public RetryTestCase() {
35 super();
36 }
37
38 public RetryTestCase(String arg0) {
39 super(arg0);
40 }
41
42 /**
43 * Override runTest() to catch AssertionFailedError and retry
44 */
45 protected void runTest() throws Throwable {
46 try {
47 super.runTest();
48 } catch (AssertionFailedError err) {
49
50 super.runTest();
51 }
52 }
53
54 }