@Test
public void exceptionsAreNotRethrown() {

    // given
    RetryListener listener = mock(RetryListener.class);
    NullPointerException expectedException = spy(new NullPointerException("test exception"));
    when(listener.notify(any())).thenThrow(expectedException);
    ItemSource itemSource = mock(FailedItemSource.class);
    int expectedSize = 1;
    int sequenceId = random.nextInt(1000) + RESERVED_KEYS;
    Map<CharSequence, ItemSource> items = new HashMap<>();
    KeySequenceSelector keySequenceSelector = createDefaultTestKeySequenceSelector(sequenceId, items);
    fillMap(items, expectedSize, keySequenceSelector, () -> itemSource);
    RetryListener[] listeners = {listener};
    RetryProcessor retryProcessor =
            createRetryProcessor(expectedSize, items, keySequenceSelector, listeners);
    // when
    retryProcessor.retry();
    // then
    verify(listener).notify(any(FailedItemSource.class));
    verify(expectedException).getMessage();
}