void () { String initial = getFirstEditor().getDocument().getText(); executeCommand(() -> typeInText("a")); String afterType1 = getFirstEditor().getDocument().getText(); executeCommand(() -> typeInText("b")); executeTransparently(() -> typeInText("1")); undo(getFirstEditor()); checkEditorText(afterType1, getFirstEditor()); executeTransparently(() -> typeInText("2")); undo(getFirstEditor()); checkEditorText(initial, getFirstEditor()); }