My code calls a server and get a old-response.
Then I want to poll until I get a different response from the server (aka new-response).
I I use while loop I can hold the new-response and use it after polling.
If I use awaitility how can I get the new-response easily?
Here is my 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<Boolean> newVersionIsReady(Version oldVersion) {
    return new Callable<Boolean>() {
        public Boolean call() throws Exception {
            Version newVersion = deploymentClient.getCurrentConfigVersion(appName);
            return !oldVersion.equals(newVersion);
        }
    };
}