@Beta
@Retention(RUNTIME)
@Target({TYPE,METHOD})
public @interface Retry
Retries can be applied to feature methods and spec classes. Applying it to
a spec class has the same effect as applying it to each feature method that
isn't already annotated with @Retry
.
A @Retry
annotation that is declared on a spec class is applied to
all features in all subclasses as well, unless a subclass declares its own
annotation. If so, the retries defined in the subclass are applied to all
feature methods declared in the subclass as well as inherited ones.
Modifier and Type | Optional Element | Description |
---|---|---|
java.lang.Class<? extends Closure> |
condition |
Condition that is evaluated to decide whether the feature should be
retried.
|
int |
count |
The number of retries.
|
int |
delay |
Delay between retries in millis, 0 to disable.
|
java.lang.Class<? extends java.lang.Throwable>[] |
exceptions |
Configures which types of Exceptions should be retried.
|
Retry.Mode |
mode |
Retry mode, controls what is retried.
|
java.lang.Class<? extends java.lang.Throwable>[] exceptions
java.lang.Class<? extends Closure> condition
RetryConditionContext
which provides access to the current exception and Specification
instance.
The feature is retried if the exception class passes the type check and the
specified condition holds true. If no condition is specified, only the type
check is performed.int delay
Retry.Mode mode