void () { Ref<String> message = new Ref<>(); TestDialogManager.setTestDialog(new TestDialog() { @Override public int show(@NotNull String m) { message.set(m); return Messages.YES; } }); CommandProcessor.getInstance().executeCommand(myProject, () -> WriteAction.run(() -> getFirstEditor().getDocument().insertString(0, " ")), null, null, UndoConfirmationPolicy.REQUEST_CONFIRMATION); undoFirstEditor(); checkEditorText(""); assertEquals(IdeBundle.message("undo.command", ActionsBundle.message("action.undo.description.empty")) + "?", message.get()); redoFirstEditor(); checkEditorText(" "); assertEquals(IdeBundle.message("redo.command", ActionsBundle.message("action.redo.description.empty")) + "?", message.get()); }