void () { Document ftDocument = createFreeThreadedDocument(); CompletableFuture<Boolean> called = new CompletableFuture<>(); WriteCommandAction.runWriteCommandAction(myProject, () -> { ftDocument.insertString(0, " "); AppUIExecutor.onUiThread().withDocumentsCommitted(myProject).submit(() -> called.complete(true)); }); assertTrue(PlatformTestUtil.waitForFuture(called, 10_000)); }