@Test
public void retryListSizeIsLowerThanMaxSizeIfNumberOfAvailableElementsIsLowerThanMaxSize() {

    // given
    RetryListener listener = mock(RetryListener.class);
    ItemSource itemSource = mock(FailedItemSource.class);
    int maxRetryBatchSize = DEFAULT_TEST_MAX_RETRY_SIZE;
    int mapSize = maxRetryBatchSize / 2;
    int sequenceId = random.nextInt(1000) + RESERVED_KEYS;
    Map<CharSequence, ItemSource> items = new HashMap<>();
    KeySequenceSelector keySequenceSelector = createDefaultTestKeySequenceSelector(sequenceId, items);
    fillMap(items, mapSize, keySequenceSelector, () -> itemSource);
    RetryListener[] listeners = {listener};
    RetryProcessor retryProcessor =
            createRetryProcessor(maxRetryBatchSize, items, keySequenceSelector, listeners);
    // when
    retryProcessor.retry();
    // then
    verify(listener, times(mapSize)).notify(any(FailedItemSource.class));
}