void () { Object leak = new Object() { }; Disposable disposable = Disposer.newDisposable(); Disposer.dispose(disposable); try { CancellablePromise<String> p = ReadAction .nonBlocking(() -> "a") .expireWith(disposable) .coalesceBy(leak) .submit(AppExecutorUtil.getAppExecutorService()); assertTrue(p.isCancelled()); LeakHunter.checkLeak(NonBlockingReadActionImpl.getTasksByEquality(), leak.getClass()); Disposer.disposeChildren(disposable, (child) -> { throw new IllegalStateException(child.toString()); }); } finally { Disposer.dispose(disposable); } }