void () { FileType typeFromPlugin = new MyTestFileType(); FileTypeFactory factory = new FileTypeFactory() { @Override public void createFileTypes(@NotNull FileTypeConsumer consumer) { consumer.consume(typeFromPlugin); } }; Element element = myFileTypeManager.getState(); Disposable disposable = Disposer.newDisposable(); try { FileTypeFactory.FILE_TYPE_FACTORY_EP.getPoint().registerExtension(factory, disposable); reInitFileTypeManagerComponent(element); WriteAction.run(() -> myFileTypeManager.associateExtension(typeFromPlugin, "foo")); element = myFileTypeManager.getState(); Disposer.dispose(disposable); disposable = Disposer.newDisposable(); reInitFileTypeManagerComponent(element); element = myFileTypeManager.getState(); FileTypeFactory.FILE_TYPE_FACTORY_EP.getPoint().registerExtension(factory, disposable); reInitFileTypeManagerComponent(element); assertEquals(typeFromPlugin, myFileTypeManager.getFileTypeByFileName("foo.foo")); myFileTypeManager.unregisterFileType(typeFromPlugin, FileTypeManagerImpl.coreIdeaPluginDescriptor()); } finally { Disposer.dispose(disposable); } }