void () { MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(getTestRootDisposable()); connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() { @Override public void before(@NotNull List<? extends @NotNull VFileEvent> events) { for (VFileEvent event : events) { VirtualFile file = event.getFile(); if (file != null && !(file.getFileSystem() instanceof TempFileSystemMarker)) { boolean shouldBeValid = !(event instanceof VFileCreateEvent); assertEquals(event.toString(), shouldBeValid, file.isValid()); } } } @Override public void after(@NotNull List<? extends @NotNull VFileEvent> events) { for (VFileEvent event : events) { VirtualFile file = event.getFile(); if (file != null && !(file.getFileSystem() instanceof TempFileSystemMarker)) { boolean shouldBeValid = !(event instanceof VFileDeleteEvent); assertEquals(event.toString(), shouldBeValid, file.isValid()); } } } }); myFS = LocalFileSystem.getInstance(); }