@Test public void objectsInListAreUsed() { task.start(progress); for (Foo o : list) { verify(o, times(1)).bar(); } }
@Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), list.size()); for (T t : list) { if (shouldStop(progress)) { return BackgroundTask.RETURN_INTERRUPTED; } run(t); progress.incrementProgress(1); } return BackgroundTask.RETURN_SUCCESS; }
SimpleBackgroundTask extends BackgroundTask { @Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), list.size()); for (T t : list) { if (shouldStop(progress)) { return BackgroundTask.RETURN_INTERRUPTED; } run(t); progress.incrementProgress(1); } return BackgroundTask.RETURN_SUCCESS; } }
SimpleBackgroundTask extends BackgroundTask { @Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), list.size()); for (T t : list) { if (shouldStop(progress)) { return BackgroundTask.RETURN_INTERRUPTED; } run(t); progress.incrementProgress(1); } return BackgroundTask.RETURN_SUCCESS; } SimpleBackgroundTask(String description, List<T> list); }
SimpleBackgroundTask extends BackgroundTask { @Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), list.size()); for (T t : list) { if (shouldStop(progress)) { return BackgroundTask.RETURN_INTERRUPTED; } run(t); progress.incrementProgress(1); } return BackgroundTask.RETURN_SUCCESS; } SimpleBackgroundTask(String description, List<T> list); @Override int start(TaskStatusMonitor progress); abstract void run(T t); }
SimpleBackgroundTask extends BackgroundTask { @Override public int start(TaskStatusMonitor progress) { progress.startProgress(this.getDescription(), list.size()); for (T t : list) { if (shouldStop(progress)) { return BackgroundTask.RETURN_INTERRUPTED; } run(t); progress.incrementProgress(1); } return BackgroundTask.RETURN_SUCCESS; } SimpleBackgroundTask(String description, List<T> list); @Override int start(TaskStatusMonitor progress); abstract void run(T t);  }