@Test
public void testAuthThrowsRetryableUnauthTooManyTimesAndWeGiveUp() throws B2Exception {

    when(policy.gotRetryableImmediately(eq(OP), anyInt(), anyLong(), any())).thenReturn(true, true, true, true, true, true, true, false);
    final Guts guts = new Guts(
            unauthorized(OTHER),
            unauthorized(UPLOADING),
            unauthorized(OTHER),
            unauthorized(UPLOADING),
            unauthorized(UPLOADING),
            unauthorized(OTHER),
            unauthorized(OTHER),
            unauthorized(OTHER),
            "this result won't be used"
            );
    boolean caughtIt = false;
    try {
        retryer.doRetry(OP, goodAuthCache, guts, policy);
    } catch (B2UnauthorizedException e) {
        assertTrue(guts.getAsException(7) == e);
        assertEquals(8, guts.getCallCount());
        verify(goodAuthCache, times(5)).clear(); // once for each OTHER.
        verify(sleeper, never()).sleepSeconds(anyInt());
        verify(policy, times(8)).gotRetryableImmediately(eq(OP), anyInt(), anyLong(), any());
        verifyNoMoreInteractions(policy);
        caughtIt = true;
    }
    assertTrue(caughtIt);
}