void () { PsiFile file = findFile(createFile()); assertNotNull(file); assertTrue(file.isPhysical()); final Document document = getDocument(file); assertNotNull(document); WriteCommandAction.runWriteCommandAction(null, () -> document.insertString(0, "class X {}")); getPsiDocumentManager().performWhenAllCommitted(() -> { try { getPsiDocumentManager().performWhenAllCommitted(() -> { }); fail("Must fail"); } catch (IncorrectOperationException ignored) { } }); getPsiDocumentManager().commitAllDocuments(); assertTrue(getPsiDocumentManager().isCommitted(document)); }