TaskExecutor implements Runnable { private void executeTask(T task) { Date taskStart = new Date(); try { taskConsumer.accept(task); onTaskFinished(task, taskStart); } catch (Throwable throwable) { onTaskFailed(task, taskStart, throwable); } } TaskExecutor(
            TaskConsumer<T> taskConsumer,
            TaskSource<T> taskSource,
            ReportWriter reportWriter,
            Component.Context context,
            File checkpointFile,
            Set<String> taskFilter); @Override void run();  }
@Test public void executeTask() { MockedTask first = new MockedTask(); TaskSource<Task> source = TaskSource.defaultTaskSource( Arrays.asList(first)); TaskExecutor<Task> executor = new TaskExecutor<>( consumer, source, report, context, null, Collections.emptySet()); executor.run(); Mockito.verify(report, Mockito.times(1)).onTaskFinished( Mockito.eq(first), Mockito.any(), Mockito.any()); }