Document (@NotNull FileType fileType, @NotNull String text, @NotNull Project project) { final PsiFile file = PsiFileFactory.getInstance(project).createFileFromText("Dummy." + fileType.getDefaultExtension(), fileType, text, -1, true); final Document document = PsiDocumentManager.getInstance(project).getDocument(file); assert document != null; return document; }