Class RetryOnExceptionStrategy
- java.lang.Object
-
- org.apache.flink.testutils.junit.extensions.retry.strategy.AbstractRetryStrategy
-
- org.apache.flink.testutils.junit.extensions.retry.strategy.RetryOnExceptionStrategy
-
- All Implemented Interfaces:
RetryStrategy
public class RetryOnExceptionStrategy extends AbstractRetryStrategy
A retry strategy that will ignore a specific type of exception and retry a test if it occurs, up to a fixed number of times.
-
-
Field Summary
-
Fields inherited from class org.apache.flink.testutils.junit.extensions.retry.strategy.AbstractRetryStrategy
hasNextAttempt, totalTimes
-
-
Constructor Summary
Constructors Constructor Description RetryOnExceptionStrategy(int retryTimes, Class<? extends Throwable> repeatableException)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandleException(String testName, int attemptIndex, Throwable throwable)Handle an exception that occurred during the annotated test attempt.-
Methods inherited from class org.apache.flink.testutils.junit.extensions.retry.strategy.AbstractRetryStrategy
hasNextAttempt, stopFollowingAttempts
-
-
-
-
Method Detail
-
handleException
public void handleException(String testName, int attemptIndex, Throwable throwable) throws Throwable
Description copied from interface:RetryStrategyHandle an exception that occurred during the annotated test attempt.This method can swallow the exception to pass the test.
- Parameters:
testName- the test nameattemptIndex- test attempt index that starts from 1throwable- the throwable that the test case throws- Throws:
org.opentest4j.TestAbortedException- When handling a test attempt failure, throwing this exception indicates another attempt should be made.Throwable- Propagating the original exception, or throwing any other exception indicates that the test has definitively failed and no further attempts should be made.
-
-