protected final <T> void convertAndProcessManyJobs(Function<List<T>, List<T>> itemSupplier, Function<T, Job> toJobFunction, Consumer<Integer> amountOfProcessedJobsConsumer) {
        int amountOfProcessedJobs = 0;
        List<T> items = getItemsToProcess(itemSupplier, null);
        while (!items.isEmpty()) {
            convertAndProcessJobs(items, toJobFunction);
            amountOfProcessedJobs += items.size();
            items = getItemsToProcess(itemSupplier, items);
        }
        amountOfProcessedJobsConsumer.accept(amountOfProcessedJobs);
    }
@Test
    void convertAndProcessManyJobsReturnsPreviousResultsSoSupplierCanChooseToContinueOrNot() {
        // GIVEN
        Function<List<Job>, List<Job>> itemSupplier = jobs -> {
            if (jobs == null) return asList(anEnqueuedJob().build(), anEnqueuedJob().build());
            else if (jobs.size() != 2) throw new IllegalStateException("Previous list with size 2 was expected");
            else return emptyList();
        };
        Function<Job, Job> toJobFunction = job -> job;

        // WHEN & THEN
        assertThatCode(() -> task.convertAndProcessManyJobs(itemSupplier, toJobFunction, System.out::println))
                .doesNotThrowAnyException();
    }