void () { final VirtualFile f1 = createChildData(myRoot, "f1.txt"); final VirtualFile f2 = createChildData(myRoot, "f2.txt"); executeCommand(() -> { rename(f1, "ff1.txt"); setDocumentText(f1, "ff1"); }); executeCommand(() -> { rename(f2, "ff2.txt"); setDocumentText(f2, "ff2"); }); // <---- test point executeCommand(() -> { rename(f2, "fff2.txt"); setDocumentText(f2, "fff2"); }); executeCommand(() -> { rename(f1, "fff1.txt"); setDocumentText(f1, "fff1"); }); globalUndo(); assertGlobalUndoIsAvailable(); assertGlobalRedoIsAvailable(); globalUndo(); assertGlobalUndoIsAvailable(); assertGlobalRedoIsAvailable(); delete(f1); // commands for f1 should be invalidated here assertGlobalUndoIsAvailable(); assertGlobalRedoIsAvailable(); globalRedo(); assertGlobalUndoIsAvailable(); assertGlobalRedoNotAvailable(); globalUndo(); globalUndo(); // back to the 'test point' assertGlobalUndoNotAvailable(); assertGlobalRedoIsAvailable(); }