void () { VirtualFile file = createChildData(myRoot, "f.txt"); final Document document = FileDocumentManager.getInstance().getDocument(file); assertNotNull(document); WriteCommandAction.runWriteCommandAction(getProject(), () -> document.setText("Some initial text content")); performInEditor(document, false, editor -> executeCommand(() -> WriteCommandAction.runWriteCommandAction(getProject(), () -> document.setText("Some initial text modification")), "Initial modification")); performInEditor(document, true, editor -> executeCommand(() -> WriteCommandAction.runWriteCommandAction(getProject(), () -> document.setText("Some breaking modification")), "Breaking modification")); performInEditor(document, false, editor -> undo(editor)); assertEquals("Some initial text modification", document.getText()); }