@Beta public class PollingConditions extends java.lang.Object
Usage example:
def conditions = new PollingConditions(timeout: 10, initialDelay: 1.5, factor: 1.25)
def machine = new Machine()
when:
machine.start()
then:
conditions.eventually {
assert machine.temperature >= 100
assert machine.efficiency >= 0.9
}
| Constructor | Description |
|---|---|
PollingConditions() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
call(double seconds,
groovy.lang.Closure<?> conditions) |
Alias for
within(double, groovy.lang.Closure). |
void |
call(groovy.lang.Closure<?> conditions) |
Alias for
eventually(groovy.lang.Closure). |
void |
eventually(groovy.lang.Closure<?> conditions) |
Repeatedly evaluates the specified conditions until they are satisfied or the timeout has elapsed.
|
double |
getDelay() |
Returns the delay (in seconds) between successive evaluations of the conditions.
|
double |
getFactor() |
Returns the factor by which the delay grows (or shrinks) after each evaluation of the conditions.
|
double |
getInitialDelay() |
Returns the initial delay (in seconds) before first evaluating the conditions.
|
double |
getTimeout() |
Returns the timeout (in seconds) until which the conditions have to be satisfied.
|
void |
setDelay(double seconds) |
Sets the delay (in seconds) between successive evaluations of the conditions.
|
void |
setFactor(double factor) |
Sets the factor by which the delay grows (or shrinks) after each evaluation of the conditions.
|
void |
setInitialDelay(double seconds) |
Sets the initial delay (in seconds) before first evaluating the conditions.
|
void |
setTimeout(double seconds) |
Sets the timeout (in seconds) until which the conditions have to be satisfied.
|
void |
within(double seconds,
groovy.lang.Closure<?> conditions) |
Repeatedly evaluates the specified conditions until they are satisfied or the specified timeout (in seconds) has elapsed.
|
public double getTimeout()
public void setTimeout(double seconds)
seconds - the timeout (in seconds) until which the conditions have to be satisfiedpublic double getInitialDelay()
public void setInitialDelay(double seconds)
seconds - the initial delay (in seconds) before first evaluating the conditionspublic double getDelay()
public void setDelay(double seconds)
seconds - the delay (in seconds) between successive evaluations of the conditions.public double getFactor()
public void setFactor(double factor)
factor - the factor by which the delay grows (or shrinks) after each evaluation of the conditionspublic void eventually(groovy.lang.Closure<?> conditions)
throws java.lang.InterruptedException
conditions - the conditions to evaluatejava.lang.InterruptedException - if evaluation is interruptedpublic void within(double seconds,
groovy.lang.Closure<?> conditions)
throws java.lang.InterruptedException
conditions - the conditions to evaluatejava.lang.InterruptedException - if evaluation is interruptedpublic void call(groovy.lang.Closure<?> conditions)
throws java.lang.InterruptedException
eventually(groovy.lang.Closure).java.lang.InterruptedExceptionpublic void call(double seconds,
groovy.lang.Closure<?> conditions)
throws java.lang.InterruptedException
within(double, groovy.lang.Closure).java.lang.InterruptedExceptionCopyright © 2018. All rights reserved