void (Runnable c1) { AtomicBoolean committed = new AtomicBoolean(); AtomicBoolean run = new AtomicBoolean(); AtomicBoolean executed = new AtomicBoolean(true); EdtTestUtil.runInEdtAndWait(() -> executed.set(PsiDocumentManager.getInstance(myFixture.getProject()).performWhenAllCommitted(() -> { run.set(true); ApplicationManager.getApplication().invokeLater(() -> { c1.run(); committed.set(true); }); }))); ApplicationManager.getApplication().assertReadAccessNotAllowed(); ApplicationManager.getApplication().assertIsNonDispatchThread(); long start = System.currentTimeMillis(); while (!committed.get()) { if (System.currentTimeMillis() - start >= 20000) { ThreadUtil.printThreadDump(); TestCase.fail("too long waiting for documents to be committed. executed: " + executed + "; run: " + run + "; "); } UIUtil.pump(); } }