void () { FileTypeIndexImpl index = FileBasedIndexExtension.EXTENSION_POINT_NAME.findExtension(FileTypeIndexImpl.class); VirtualFile file = myFixture.configureByText("foo.test", "abc").getVirtualFile(); FileTypeIndex.getFiles(PlainTextFileType.INSTANCE, GlobalSearchScope.allScope(getProject())); int version = index.getVersion(); Disposable disposable = Disposer.newDisposable(); FileType foo = registerFakeFileType(getTestName(false), "test", disposable); try { assertEquals(version, index.getVersion()); Collection<VirtualFile> files = FileTypeIndex.getFiles(foo, GlobalSearchScope.allScope(getProject())); assertOneElement(files); assertEquals(foo, FileTypeIndex.getIndexedFileType(file, getProject())); } finally { Disposer.dispose(disposable); } assertEquals(PlainTextFileType.INSTANCE, FileTypeIndex.getIndexedFileType(file, getProject())); assertEmpty(FileTypeIndex.getFiles(foo, GlobalSearchScope.allScope(getProject()))); }