void () { setupUncommittedDocument(); Semaphore mayStartWrite = new Semaphore(1); Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(() -> { ReadAction.run(() -> { mayStartWrite.up(); assertEquals("a", ReadAction.nonBlocking(() -> { return "a"; }).executeSynchronously()); }); }); assertTrue(mayStartWrite.waitFor(1000)); WriteAction.run(() -> {}); waitForFuture(future); }