@Test
public void executeShouldRetryUntilSuccessUsingRetryHandler() throws Exception {

    RequestException requestException1 = mock(RequestException.class);
    RequestException requestException2 = mock(RequestException.class);
    when(retryHandler.retry(requestException1, 2)).thenReturn(true);
    when(retryHandler.retry(requestException2, 3)).thenReturn(true);
    when(mockRequestExecutor.execute(request)).thenThrow(requestException1, requestException2).thenReturn(expected);
    Response actual = toTest.execute(request);
    assertSame(expected, actual);
    verify(requestException1).dispose();
    verify(requestException2).dispose();
}