void () { String testName = getTestName(true); RangeHighlighter[] ranges = myFixture.testHighlightUsages(testName + ".yml"); EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); TextAttributes readAttributes = scheme.getAttributes(EditorColors.SEARCH_RESULT_ATTRIBUTES); TextAttributes writeAttributes = scheme.getAttributes(EditorColors.WRITE_SEARCH_RESULT_ATTRIBUTES); StringBuilder result = new StringBuilder(); Editor editor = myFixture.getEditor(); List<RangeHighlighter> highlighters = Arrays.asList(ranges); ContainerUtil.sort(highlighters, Comparator.comparingInt(RangeMarker::getStartOffset)); for (RangeHighlighter highlighter : highlighters) { String usageType; TextAttributes attributes = highlighter.getTextAttributes(null); if (attributes == null) { continue; } else if (attributes.equals(readAttributes)) { usageType = "read usage"; } else if (attributes.equals(writeAttributes)) { usageType = "write usage"; } else { continue; } TextRange range = TextRange.create(highlighter.getStartOffset(), highlighter.getEndOffset()); CharSequence text = highlighter.getDocument().getCharsSequence(); result .append(editor.offsetToLogicalPosition(range.getStartOffset())) .append(" - '") .append(range.subSequence(text)) .append("': ") .append(usageType) .append("\n") ; } assertSameLinesWithFile(getTestDataPath() + testName + ".highlight.txt", result.toString()); }