title: RestAssured with Awaitility
body: <p>I currently have some code which needs some retry logic. As some remote requests and database updates might take some time. I don't want to add a specific wait for this. I want to retry until it is matching my specific response. Currently it is using awaitility and it will retry until a specific field is matching.</p>
  
  <pre><code>private static RequestSpecification REQUEST_SPEC(String baseUri) {
       return new RequestSpecBuilder()
           .setBaseUri(baseUri)
           .setBasePath(DEFAULT_PATH)
           .setAccept(ContentType.JSON)  
           .setContentType(ContentType.JSON)
           .setConfig(config().logConfig(logConfig().enableLoggingOfRequestAndResponseIfValidationFails()))
           .build();
  }
  </code></pre>
  
  <pre><code>private static ResponseSpecBuilder PROFILE_RESPONSE() {
      return new ResponseSpecBuilder()
          .expectStatusCode(HTTP_OK)
          .expectBody("profileId", equalTo(PROFILE_ID))
          .expectBody("userKey", notNullValue());
  }
  </code></pre>
  
  <pre><code>await().timeout(10, SECONDS).untilAsserted(() -&gt; assertThat("Profile not yet updated",
     given()
        .spec(REQUEST_SPEC)
        .pathParam("somePathParam", "somePathParamValue")
        .auth().oauth2("someAccessToken")
     .when() 
        .get("/someRequestPath")
     .then()
        .spec(PROFILE_RESPONSE)
     .extract() 
        .body().jsonPath().getString("profileId"), equalTo("updatedProfileId")));
  </code></pre>
  
  <p>I'm combining build-in RestAssured mechanisms (reusable ResponseSpecifications) and awaitility with hamcrest matcher. Is there a way to retry upon RestAssured ValidatableResponse instead of extracting it and validate it with an hamcrest assertThat() matcher? </p>