void () { File file = tempDirectory.newFile("subDir1/subDir2/subDir3/file.txt"); VirtualFileSystemEntry vFile = (VirtualFileSystemEntry)refreshAndFind(file); VirtualFileSystemEntry vSubDir3 = vFile.getParent(); VirtualFileSystemEntry vSubDir2 = vSubDir3.getParent(); VirtualFileSystemEntry vSubDir1 = vSubDir2.getParent(); PersistentFSImpl fs = (PersistentFSImpl)PersistentFS.getInstance(); VirtualFileSystemEntry[] hardReferenceHolder = {vFile, vSubDir3, vSubDir2, vSubDir1}; VfsTestUtil.deleteFile(vSubDir1); for (VirtualFileSystemEntry f : hardReferenceHolder) { assertFalse("file is valid but deleted " + f.getName(), f.isValid()); } for (VirtualFileSystemEntry f : hardReferenceHolder) { assertNull(fs.getCachedDir(f.getId())); assertNull(fs.findFileById(f.getId())); } for (VirtualFileSystemEntry f : fs.getDirCache()) { assertTrue(f.isValid()); } }