void () { String fileName = "Test.java"; FileType fileType = FileTypeRegistry.getInstance().getFileTypeByFileName(fileName); PsiFile psiFile = PsiFileFactory.getInstance(getProject()).createFileFromText(fileName, fileType, "class Test {}", 0, false); VirtualFile virtualFile = psiFile.getViewProvider().getVirtualFile(); Document document = FileDocumentManager.getInstance().getDocument(virtualFile); assertNotNull(document); EditorFactory editorFactory = EditorFactory.getInstance(); EditorEx editor = (EditorEx)editorFactory.createViewer(document, getProject()); editor.setHighlighter(HighlighterFactory.createHighlighter(getProject(), fileType)); try { editor.getSelectionModel().setSelection(0, document.getTextLength()); String syntaxInfo = getSyntaxInfo(editor, psiFile); assertEquals(""" foreground=java.awt.Color[r=0,g=0,b=128],fontStyle=1,text=class\s foreground=java.awt.Color[r=0,g=0,b=0],fontStyle=0,text=Test {} """, syntaxInfo); } finally { editorFactory.releaseEditor(editor); } }