Rest Assured - retry request if failed
<p>Example Test:</p>

<pre><code>@Test
public void shouldGetRoutesList() {
    Response response =
            given()
                    .headers("RequestId", 10)
                    .headers("Authorization", accessToken)
                    .contentType(ContentType.JSON).
            expect()
                    .statusCode(HttpURLConnection.HTTP_OK).
            when()
                    .get("address");
    String responseBody = response.getBody().asString();
    System.out.println(responseBody);
    logger.info("Log message");
}
</code></pre>

<p>Thing is that sometimes response from service equals 500 error. It's because of application error and it's application fault so I would like to add temp. workaround to retry <code>.get</code> if service returns 500. I was thinking about <code>if</code> or <code>do-while</code> but I know that it's not very clever way. Anyone could advice some solution ?</p>

<p>In another words - I want to retry whole test (or just .get) if statusCode=!HTTP_OK</p>