@Override
    protected void runTask() {
        if (backgroundJobServer.isRunning() && reentrantLock.tryLock()) {
            try {
                LOGGER.trace("Looking for enqueued jobs... ");
                final AmountRequest workPageRequest = workDistributionStrategy.getWorkPageRequest();
                if (workPageRequest.getLimit() > 0) {
                    final List<Job> enqueuedJobs = storageProvider.getJobsToProcess(backgroundJobServer, workPageRequest);
                    enqueuedJobs.forEach(backgroundJobServer::processJob);
                    LOGGER.debug("Found {} enqueued jobs to process.", enqueuedJobs.size());
                }
            } finally {
                reentrantLock.unlock();
            }
        }
    }
@Test
    void testTask() {
        Job enqueuedJob1 = anEnqueuedJob().build();
        Job enqueuedJob2 = anEnqueuedJob().build();
        when(storageProvider.getJobsToProcess(eq(backgroundJobServer), any())).thenReturn(asList(enqueuedJob1, enqueuedJob2), emptyJobList());
        runTask(task);

        verify(backgroundJobServer).processJob(enqueuedJob1);
        verify(backgroundJobServer).processJob(enqueuedJob2);
    }