awaitility/src/main/java/org/awaitility/core/ConditionFactory.java
public <T> T until(final Callable<T> supplier, final Matcher<? super T> matcher) {
        return until(new CallableHamcrestCondition<T>(supplier, matcher, generateConditionSettings()));
    }
public <T> T until(final Callable<T> supplier, final Matcher<? super T> matcher) {
        return until(new CallableHamcrestCondition<T>(supplier, matcher, generateConditionSettings()));
    }
public < T > T until ( final Callable < T > supplier , final Matcher < ? super T > matcher ) { return until ( new CallableHamcrestCondition < T > ( supplier , matcher , generateConditionSettings ( ) ) ) ; }
Await until a {@link java.util.concurrent.Callable} supplies a value matching the specified
{@link org.hamcrest.Matcher}. E.g.
<p>&nbsp;</p>
<pre>
await().until(numberOfPersons(), is(greaterThan(2)));
</pre>
<p>&nbsp;</p>
where "numberOfPersons()" returns a standard {@link java.util.concurrent.Callable}:
<p>&nbsp;</p>
<pre>
private Callable&lt;Integer&gt; numberOfPersons() {
return new Callable&lt;Integer&gt;() {
public Integer call() {
return personRepository.size();
}
};
}
</pre>
<p>&nbsp;</p>
Using a generic {@link java.util.concurrent.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.
<p>&nbsp;</p>
<pre>
await().until(numberOfPersons(), is(equalTo(6)));
</pre>

@param <T>      the generic type
@param supplier the supplier that is responsible for getting the value that
should be matched.
@param matcher  the matcher The hamcrest matcher that checks whether the
condition is fulfilled.
@return a T object.
@throws org.awaitility.core.ConditionTimeoutException If condition was not fulfilled within the given time period.
Await until a { @link java . util . concurrent . Callable } supplies a value matching the specified { @link org . hamcrest . Matcher } . E . g . <p > &nbsp ; < / p > <pre > await () . until ( numberOfPersons () is ( greaterThan ( 2 ))) ; < / pre > <p > &nbsp ; < / p > where numberOfPersons () returns a standard { @link java . util . concurrent . Callable } : <p > &nbsp ; < / p > <pre > private Callable&lt ; Integer&gt ; numberOfPersons () { return new Callable&lt ; Integer&gt ; () { public Integer call () { return personRepository . size () ; } } ; } < / pre > <p > &nbsp ; < / p > Using a generic { @link java . util . concurrent . 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 . <p > &nbsp ; < / p > <pre > await () . until ( numberOfPersons () is ( equalTo ( 6 ))) ; < / pre >