void () { final AtomicBoolean myDisposeFlag = new AtomicBoolean(false); TaskWithEquivalentObject task = new TaskWithEquivalentObject(this) { @Override public void perform(@NotNull ProgressIndicator indicator) { } @Override public void dispose() { myDisposeFlag.set(true); } }; myQueue.addTask(task); myQueue.cancelTask(task); myQueue.disposePendingTasks(); Assert.assertTrue(Disposer.isDisposed(task)); Assert.assertTrue(myDisposeFlag.get()); }