void () { typeInText("foo"); checkEditorState("footest", 3, 0, 0); executeTransparently(() -> WriteCommandAction.runWriteCommandAction(null, () -> getFirstEditor().getDocument().insertString(0, "bar"))); checkEditorState("barfootest", 6, 0, 0); executeCommand( () -> ApplicationManager.getApplication().runWriteAction(() -> getFirstEditor().getDocument().insertString(0, "___")), "Dummy"); checkEditorState("___barfootest", 9, 0, 0); undoFirstEditor(); checkEditorState("barfootest", 6, 0, 0); undoFirstEditor(); checkEditorState("test", 0, 0, 0); }