void () { executeTransparentlyInWriteAction(() -> getFirstEditor().getDocument().insertString(4, " ")); executeCommand(() -> { typeInChar('a'); typeInChar(getSecondEditor(), 'A'); }); while (isUndoAvailable(getFirstEditor())) undo(getFirstEditor()); checkEditorText("test"); while (isRedoAvailable(getFirstEditor())) redo(getFirstEditor()); checkEditorText("atest "); }