void (VirtualFile file, HighlightPointer... expected) { Editor editor = getEditor(file); HighlightUsagesHandler.invoke(myProject, editor, getTestPsiFile(file)); RangeHighlighter[] highlighters = editor.getMarkupModel().getAllHighlighters(); List<HighlightPointer> actual = new ArrayList<>(); for (RangeHighlighter each: highlighters) { if (!each.isValid()) continue; int offset = each.getStartOffset(); PsiElement element = getTestPsiFile(file).findElementAt(offset); element = PsiTreeUtil.getParentOfType(element, XmlTag.class); String text = editor.getDocument().getText().substring(offset, each.getEndOffset()); actual.add(new HighlightPointer(element, text)); } assertUnorderedElementsAreEqual(actual, expected); }