Collection<PsiErrorElement> (@NotNull LanguageCodeStyleSettingsProvider provider, @NotNull String sample) { PsiFile file = provider.createFileFromText(getProject(), sample); if (file == null) { Language language = provider.getLanguage(); LanguageFileType type = language.getAssociatedFileType(); if (type == null) return new ArrayList<>(); file = myFixture.configureByText(type, sample); } return PsiTreeUtil.collectElementsOfType(file, PsiErrorElement.class); }