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