@Override
    protected void runTask() {
        LOGGER.trace("Looking for succeeded jobs that can go to the deleted state... ");
        final Instant updatedBefore = now().minus(backgroundJobServerConfiguration().getDeleteSucceededJobsAfter());
        processManyJobs(previousResults -> getSucceededJobs(updatedBefore, previousResults),
                job -> job.delete("JobRunr maintenance - deleting succeeded job"),
                this::handleTotalAmountOfSucceededJobs);
    }
@Test
    void testTask() {
        Job succeededJob1 = aSucceededJob().build();
        Job succeededJob2 = aSucceededJob().build();
        when(storageProvider.getJobList(eq(SUCCEEDED), any(), any())).thenReturn(asList(succeededJob1, succeededJob2), emptyJobList());
        runTask(task);

        verify(storageProvider).save(anyList());
        verify(storageProvider).publishTotalAmountOfSucceededJobs(2);

        assertThat(logAllStateChangesFilter.getStateChanges(succeededJob1)).containsExactly("SUCCEEDED->DELETED");
        assertThat(logAllStateChangesFilter.getStateChanges(succeededJob2)).containsExactly("SUCCEEDED->DELETED");
        assertThat(logAllStateChangesFilter.onProcessingIsCalled(succeededJob1)).isFalse();
        assertThat(logAllStateChangesFilter.onProcessingIsCalled(succeededJob2)).isFalse();
        assertThat(logAllStateChangesFilter.onProcessingSucceededIsCalled(succeededJob1)).isFalse();
        assertThat(logAllStateChangesFilter.onProcessingSucceededIsCalled(succeededJob2)).isFalse();
    }