@Test
void schedulesRetryOnSessionExpiredExceptionAsync()
{

    String result = "The Result";
    Clock clock = mock( Clock.class );
    ExponentialBackoffRetryLogic retryLogic = newRetryLogic( 1, 4242, 1, 0, clock );
    Supplier<CompletionStage<Object>> workMock = newWorkMock();
    SessionExpiredException error = sessionExpired();
    when( workMock.get() ).thenReturn( failedFuture( error ) ).thenReturn( completedFuture( result ) );
    assertEquals( result, await( retryLogic.retryAsync( workMock ) ) );
    verify( workMock, times( 2 ) ).get();
    List<Long> scheduleDelays = eventExecutor.scheduleDelays();
    assertEquals( 1, scheduleDelays.size() );
    assertEquals( 4242, scheduleDelays.get( 0 ).intValue() );
}