void (UndoConfirmationPolicy policy1, UndoConfirmationPolicy policy2, boolean expected) { final VirtualFile file1 = createChildData(myRoot, "file1.txt"); final VirtualFile file2 = createChildData(myRoot, "file2.txt"); final Document document1 = FileDocumentManager.getInstance().getDocument(file1); final Document document2 = FileDocumentManager.getInstance().getDocument(file2); String groupId = "ID"; changeText(document1, "text1", policy1, groupId); changeText(document2, "text2", policy2, groupId); UndoManager undoManager = UndoManager.getInstance(myProject); Mock.MyFileEditor fileEditor = new Mock.MyFileEditor(document1, document2) { @Override public @NotNull VirtualFile getFile() { return file1; } }; assertTrue(undoManager.isUndoAvailable(fileEditor)); undoManager.undo(fileEditor); assertEquals(expected, myConfirmationWasRequested); assertEquals("", document1.getText()); assertEquals("", document2.getText()); delete(file1); delete(file2); myConfirmationWasRequested = false; }