void (@Nullable String expectedCommandName) { runInEdtAndWait(() -> { final TestDialog oldTestDialog = TestDialogManager.setTestDialog(TestDialog.OK); try { UndoManager undoManager = UndoManager.getInstance(myProject); assertTrue("undo is not available", undoManager.isUndoAvailable(null)); if (expectedCommandName != null) { String undoText = undoManager.getUndoActionNameAndDescription(null).first; assumeTrue("Unexpected VFS command on undo stack, suspecting IDEA-182560. Test aborted. Undo on stack: " + undoText, undoText != null && undoText.contains(expectedCommandName)); } undoManager.undo(null); } finally { TestDialogManager.setTestDialog(oldTestDialog); } }); }