void () { final VirtualFile[] dir = new VirtualFile[1]; final VirtualFile[] file = new VirtualFile[1]; executeCommand(() -> { dir[0] = createChildDirectory(myRoot, "dir"); file[0] = createChildData(dir[0], "file.txt"); }); setDocumentText(file[0], "document"); executeCommand(() -> { rename(dir[0], "dir2"); setDocumentText(file[0], "document2"); }); for (int i = 0; i < 2; i++) { globalUndo(); assertNull(myRoot.findChild("dir2")); dir[0] = myRoot.findChild("dir"); assertNotNull(dir); file[0] = dir[0].findChild("file.txt"); assertNotNull(file[0]); assertEquals("document", getDocumentText(file[0])); globalRedo(); assertNull(myRoot.findChild("dir")); dir[0] = myRoot.findChild("dir2"); assertNotNull(dir); file[0] = dir[0].findChild("file.txt"); assertNotNull(file[0]); assertEquals("document2", getDocumentText(file[0])); } }