void () { File fileToDelete = tempDir.newFile("file.txt"); VirtualFilePointer pointer = createPointerByFile(fileToDelete, null); assertTrue(pointer.isValid()); VirtualFile file = pointer.getFile(); assertNotNull(file); MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(disposable); connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { @Override public void after(@NotNull List<? extends @NotNull VFileEvent> events) { Object url = ((VirtualFilePointerImpl)pointer).myNode.myFileOrUrl; assertTrue(url.toString(), url instanceof String); assertFalse(pointer.isValid()); } }); VfsTestUtil.deleteFile(getVirtualFile(fileToDelete)); }