@Test
public void testAuthThrowsRetryableUnauthSeveralTimesButWorksBeforeWeGiveUp() throws B2Exception {

    when(policy.gotRetryableImmediately(eq(OP), anyInt(), anyLong(), any())).thenReturn(true);
    // this throws a B2UnauthorizedException until the last attempt, when it replies.
    final Guts guts = new Guts(
            unauthorized(OTHER),
            unauthorized(OTHER),
            unauthorized(OTHER),
            unauthorized(OTHER),
            unauthorized(OTHER),
            unauthorized(OTHER),
            "hello"
            );
    assertEquals("hello", retryer.doRetry(OP, goodAuthCache, guts, policy));
    assertEquals(7, guts.getCallCount());
    verify(goodAuthCache, times(6)).clear();
    verify(sleeper, never()).sleepSeconds(anyInt());
    verify(policy, times(6)).gotRetryableImmediately(eq(OP), anyInt(), anyLong(), any(B2UnauthorizedException.class));
}