|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jayway.awaitility.core.ConditionFactory
public class ConditionFactory
A factory for creating Condition objects. It's not recommended to
instantiate this class directly.
| Constructor Summary | |
|---|---|
ConditionFactory(Duration timeout,
Duration pollInterval,
Duration pollDelay,
boolean catchUncaughtExceptions)
Instantiates a new condition factory. |
|
ConditionFactory(String alias,
Duration timeout,
Duration pollInterval,
Duration pollDelay,
boolean catchUncaughtExceptions)
Instantiates a new condition factory. |
|
| Method Summary | ||
|---|---|---|
ConditionFactory |
and()
A method to increase the readability of the Awaitility DSL. |
|
ConditionFactory |
atMost(Duration timeout)
Await at most timeout before throwing a timeout exception. |
|
ConditionFactory |
atMost(long timeout,
TimeUnit unit)
Await at most timeout before throwing a timeout exception. |
|
ConditionFactory |
await()
Await for an asynchronous operation. |
|
ConditionFactory |
await(String alias)
Await for an asynchronous operation and give this await instance a particular name. |
|
ConditionFactory |
catchUncaughtExceptions()
Instruct Awaitility to catch uncaught exceptions from other threads. |
|
ConditionFactory |
dontCatchUncaughtExceptions()
Don't catch uncaught exceptions in other threads. |
|
ConditionFactory |
forever()
Await forever until the condition is satisfied. |
|
ConditionFactory |
given()
A method to increase the readability of the Awaitility DSL. |
|
ConditionFactory |
pollDelay(Duration pollDelay)
Specify the delay that will be used before Awaitility starts polling for the result the first time. |
|
ConditionFactory |
pollDelay(long delay,
TimeUnit unit)
Specify the delay that will be used before Awaitility starts polling for the result the first time. |
|
ConditionFactory |
pollInterval(Duration pollInterval)
Specify the polling interval Awaitility will use for this await statement. |
|
ConditionFactory |
pollInterval(long pollInterval,
TimeUnit unit)
Specify the polling interval Awaitility will use for this await statement. |
|
ConditionFactory |
then()
A method to increase the readability of the Awaitility DSL. |
|
ConditionFactory |
timeout(Duration timeout)
Await at most timeout before throwing a timeout exception. |
|
ConditionFactory |
timeout(long timeout,
TimeUnit unit)
Await at most timeout before throwing a timeout exception. |
|
|
until(Callable<Boolean> conditionEvaluator)
Await until a Callable returns true. |
|
|
until(Callable<T> supplier,
org.hamcrest.Matcher<? super T> matcher)
Await until a Callable supplies a value matching the specified
Matcher. |
|
void |
untilAtomic(AtomicBoolean atomic,
org.hamcrest.Matcher<? super Boolean> matcher)
Await until a Atomic variable has a value matching the specified Matcher. |
|
void |
untilAtomic(AtomicInteger atomic,
org.hamcrest.Matcher<? super Integer> matcher)
Await until a Atomic variable has a value matching the specified Matcher. |
|
void |
untilAtomic(AtomicLong atomic,
org.hamcrest.Matcher<? super Long> matcher)
Await until a Atomic variable has a value matching the specified Matcher. |
|
|
untilAtomic(AtomicReference<V> atomic,
org.hamcrest.Matcher<? super V> matcher)
Await until a Atomic variable has a value matching the specified Matcher. |
|
|
untilCall(T ignore,
org.hamcrest.Matcher<? super T> matcher)
Specify the condition that must be met when waiting for a method call. |
|
void |
untilTrue(AtomicBoolean atomic)
Await until a Atomic boolean becomes true. |
|
ConditionFactory |
with()
A method to increase the readability of the Awaitility DSL. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConditionFactory(String alias,
Duration timeout,
Duration pollInterval,
Duration pollDelay,
boolean catchUncaughtExceptions)
alias - the aliastimeout - the timeoutpollInterval - the poll intervalpollDelay - The poll delaycatchUncaughtExceptions - the catch uncaught exceptions
public ConditionFactory(Duration timeout,
Duration pollInterval,
Duration pollDelay,
boolean catchUncaughtExceptions)
timeout - the timeoutpollInterval - the poll intervalpollDelay - The delay before the polling startscatchUncaughtExceptions - the catch uncaught exceptions| Method Detail |
|---|
public ConditionFactory timeout(Duration timeout)
timeout before throwing a timeout exception.
timeout - the timeout
public ConditionFactory atMost(Duration timeout)
timeout before throwing a timeout exception.
timeout - the timeout
public ConditionFactory forever()
public ConditionFactory pollInterval(Duration pollInterval)
Note that the poll delay will be automatically set as to the same value
as the interval unless it's specified explicitly using
pollDelay(Duration), pollDelay(long, TimeUnit) or
pollDelay(com.jayway.awaitility.Duration), or
ConditionFactory#andWithPollDelay(long, TimeUnit)}.
pollInterval - the poll interval
public ConditionFactory timeout(long timeout,
TimeUnit unit)
timeout before throwing a timeout exception.
timeout - the timeoutunit - the unit
public ConditionFactory pollDelay(long delay,
TimeUnit unit)
delay - the delayunit - the unit
public ConditionFactory pollDelay(Duration pollDelay)
pollDelay - the poll delay
public ConditionFactory atMost(long timeout,
TimeUnit unit)
timeout before throwing a timeout exception.
timeout - the timeoutunit - the unit
public ConditionFactory pollInterval(long pollInterval,
TimeUnit unit)
Note that the poll delay will be automatically set as to the same value
as the interval unless it's specified explicitly using
pollDelay(Duration), pollDelay(long, TimeUnit) or
pollDelay(com.jayway.awaitility.Duration) , or
ConditionFactory#andWithPollDelay(long, TimeUnit)}.
pollInterval - the poll intervalunit - the unit
public ConditionFactory catchUncaughtExceptions()
true.
public ConditionFactory await()
throws Exception
ConditionFactory instance and is used only to get a more
fluent-like syntax.
Exception - the exception
public ConditionFactory await(String alias)
throws Exception
alias - the alias
Exception - the exception
public ConditionFactory and()
throws Exception
Exception - the exception
public ConditionFactory with()
throws Exception
Exception - the exception
public ConditionFactory then()
throws Exception
Exception - the exception
public ConditionFactory given()
throws Exception
Exception - the exceptionpublic ConditionFactory dontCatchUncaughtExceptions()
public <T> void untilCall(T ignore,
org.hamcrest.Matcher<? super T> matcher)
throws Exception
await().untilCall(to(orderService).size(), is(greaterThan(2)));
T - the generic typeignore - the return value of the method callmatcher - The condition that must be met when
Exception - the exception
public <T> void until(Callable<T> supplier,
org.hamcrest.Matcher<? super T> matcher)
throws Exception
Callable supplies a value matching the specified
Matcher. E.g.
await().until(numberOfPersons(), is(greaterThan(2)));where "numberOfPersons()" returns a standard
Callable:
private Callable<Integer> numberOfPersons() {
return new Callable<Integer>() {
public Integer call() throws Exception {
return personRepository.size();
}
};
}
Using a generic Callable as done by using this version of "until"
allows you to reuse the "numberOfPersons()" definition in multiple await
statements. I.e. you can easily create another await statement (perhaps
in a different test case) using e.g.
await().until(numberOfPersons(), is(equalTo(6)));
T - the generic typesupplier - the supplier that is responsible for getting the value that
should be matched.matcher - the matcher The hamcrest matcher that checks whether the
condition is fulfilled.
Exception - the exception
public void untilAtomic(AtomicInteger atomic,
org.hamcrest.Matcher<? super Integer> matcher)
throws Exception
Matcher. E.g.
await().untilAtomic(myAtomic, is(greaterThan(2)));
atomic - the atomic variablematcher - the matcher The hamcrest matcher that checks whether the
condition is fulfilled.
Exception - the exception
public void untilAtomic(AtomicLong atomic,
org.hamcrest.Matcher<? super Long> matcher)
throws Exception
Matcher. E.g.
await().untilAtomic(myAtomic, is(greaterThan(2)));
atomic - the atomic variablematcher - the matcher The hamcrest matcher that checks whether the
condition is fulfilled.
Exception - the exception
public void untilAtomic(AtomicBoolean atomic,
org.hamcrest.Matcher<? super Boolean> matcher)
throws Exception
Matcher. E.g.
await().untilAtomic(myAtomic, is(greaterThan(2)));
atomic - the atomic variablematcher - the matcher The hamcrest matcher that checks whether the
condition is fulfilled.
Exception - the exception
public void untilTrue(AtomicBoolean atomic)
throws Exception
atomic - the atomic variable
Exception - the exception
public <V> void untilAtomic(AtomicReference<V> atomic,
org.hamcrest.Matcher<? super V> matcher)
throws Exception
Matcher. E.g.
await().untilAtomic(myAtomic, is(greaterThan(2)));
number - the atomic variablematcher - the matcher The hamcrest matcher that checks whether the
condition is fulfilled.
Exception - the exception
public <T> void until(Callable<Boolean> conditionEvaluator)
throws Exception
Callable returns true. This is method
is not as generic as the other variants of "until" but it allows for a
more precise and in some cases even more english-like syntax. E.g.
await().until(numberOfPersonsIsEqualToThree());where "numberOfPersonsIsEqualToThree()" returns a standard
Callable of type Boolean:
private Callable<Boolean> numberOfPersons() {
return new Callable<Boolean>() {
public Boolean call() throws Exception {
return personRepository.size() == 3;
}
};
}
T - the generic typeconditionEvaluator - the condition evaluator
Exception - the exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||