How can I save aside an object in awaitility callback?
<p>My code calls a server and get a <code>old-response</code>.</p>

<p>Then I want to poll until I get a different response from the server (aka <code>new-response</code>).</p>

<p>I I use while loop I can hold the <code>new-response</code> and use it after polling.</p>

<p>If I use <code>awaitility</code> how can I get the <code>new-response</code> easily?</p>

<p>Here is my code:</p>

<pre><code>public Version waitForNewConfig() throws Exception {
    Version oldVersion = deploymentClient.getCurrentConfigVersion(appName);
    await().atMost(1, MINUTES).pollInterval(5, SECONDS).until(newVersionIsReady(oldVersion));
    Version newVersion = deploymentClient.getCurrentConfigVersion(appName);

}

private Callable&lt;Boolean&gt; newVersionIsReady(Version oldVersion) {
    return new Callable&lt;Boolean&gt;() {
        public Boolean call() throws Exception {
            Version newVersion = deploymentClient.getCurrentConfigVersion(appName);

            return !oldVersion.equals(newVersion);
        }
    };
}
</code></pre>