void () { setupUncommittedDocument(); AtomicBoolean started = new AtomicBoolean(); Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(() -> { String s = ReadAction.nonBlocking(() -> { started.set(true); return ""; }).withDocumentsCommitted(getProject()).executeSynchronously(); assertEquals("", s); }); assertFalse(started.get()); UIUtil.dispatchAllInvocationEvents(); assertFalse(started.get()); UIUtil.dispatchAllInvocationEvents(); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); waitForFuture(future); assertTrue(started.get()); }