@Test
public void testCallRetriesAndSucceeds() throws Exception {

  MockSleeper sleeper = new MockSleeper();
  ArrayList<Exception> exceptions = new ArrayList<>();
  exceptions.add(new SocketTimeoutException("socket"));
  exceptions.add(new SocketTimeoutException("socket2"));
  exceptions.add(new SocketTimeoutException("socket3"));
  CallableTester<Exception> callTester = new CallableTester<>(exceptions);
  BackOff backoff = new RetryBoundedBackOff(3, new BackOffTester());
  assertThat(
          ResilientOperation.retry(
              callTester, backoff, RetryDeterminer.DEFAULT, Exception.class, sleeper))
      .isEqualTo(3);
  assertThat(callTester.timesCalled()).isEqualTo(4);
  verifySleeper(sleeper, 3);
}