void () { Disposable disposable = Disposer.newDisposable(); Disposer.dispose(disposable); Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(() -> { assertThrows(ProcessCanceledException.class, () -> { ReadAction.nonBlocking(() -> "").expireWhen(() -> true).executeSynchronously(); }); assertThrows(ProcessCanceledException.class, () -> { ReadAction.nonBlocking(() -> "").expireWith(disposable).executeSynchronously(); }); }); waitForFuture(future); }