void () { List<Integer> disposeLog = new ArrayList<>(); List<Integer> childLog = new ArrayList<>(); MergeableQueueTask<?> task = new LoggingTask(1, childLog, disposeLog); myQueue.addTask(task); myQueue.cancelTask(task); runAllTasks(); Assert.assertEquals("Cancelled task must not run " + childLog, Collections.emptyList(), childLog); Assert.assertEquals("Cancelled task must dispose " + disposeLog, Collections.singletonList(1), disposeLog); }