Package org.apache.flink.testutils.junit
Annotation Type RetryOnException
-
@Retention(RUNTIME) @Target({METHOD,TYPE}) @Inherited public @interface RetryOnException
Annotation to use withRetryRule.Add the
RetryRuleto your test class and annotate the class and/or tests withRetryOnException.@RetryOnException(times=1, exception=IOException.class) public class YourTest { @Rule public RetryRule retryRule = new RetryRule(); @Test public void yourTest() throws Exception { // This will be retried 1 time (total runs 2) before failing the test. throw new IOException("Failing test"); } @Test @RetryOnException(times=2, exception=IOException.class) public void yourTest() throws Exception { // This will be retried 2 times (total runs 3) before failing the test. throw new IOException("Failing test"); } @Test @RetryOnException(times=1, exception=IOException.class) public void yourTest() throws Exception { // This will not be retried, because it throws the wrong exception throw new IllegalStateException("Failing test"); } }