Simulation implements Runnable, TaskListener, Cancellable { @Override public void taskFinished(org.openide.util.Task task) { finishedCount.incrementAndGet(); TestCase tc = testCaseTasks.remove(task); result.addTestCaseResult(tc.getResult()); synchronized (scPool) { scPool.offer(tc.getResult().getSupplyChain()); scPool.notify(); } synchronized (pcLock) { if (finishedCount.get() % 1000 == 0) { progressContributor.progress(finishedCount.get() + " of " + testCaseCount + " test cases run.", finishedCount.get()); } if (isDone()) { running.set(false); progressContributor.finish(); } } } Simulation(SupplyChain supplyChain, int testCaseCount, String id); boolean isDone(); double getProgress(); SimulationResult getResult(); ProgressContributor getProgressContributor(); @Override void run(); @Override void taskFinished(org.openide.util.Task task); @Override boolean cancel();  }
@Test public void testTaskFinished() { }