void (String... texts) { List<RangeHighlighter> highlighters = ContainerUtil.filter(getEditor().getMarkupModel().getAllHighlighters(), it -> it.getLayer() == HighlightManagerImpl.OCCURRENCE_LAYER); List<String> actual = ContainerUtil.map(highlighters, it -> getFile().getText().substring(it.getStartOffset(), it.getEndOffset())); assertSameElements(actual, texts); }