void (String initialFileContent, String insertedContent, Class<?> expectedFileType) { PsiFile psiFile = myFixture.configureByText("a", initialFileContent); assertTrue(psiFile.getFileType() instanceof PlainTextFileType); myFixture.type(insertedContent); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(getProject()); FileDocumentManager.getInstance().saveDocument(documentManager.getDocument(psiFile)); ApplicationManager.getApplication().runWriteAction(() -> { FileTypeManagerEx fileTypeManagerEx = (FileTypeManagerEx)FileTypeManager.getInstance(); fileTypeManagerEx.makeFileTypesChange("sh file type detector test", EmptyRunnable.getInstance()); }); assertTrue(expectedFileType.isInstance(myFixture.getFile().getFileType())); }