void (final String text, final String textAfter) { String fileName = "before." + getFileExtension(); PsiFile file = createFileFromText(text, fileName, PsiFileFactory.getInstance(getProject())); checkDocument(file, text, textAfter); }