void () { ThreadingAssertions.assertEventDispatchThread(); initText(" ".repeat(100)); Document document = getDocument(getFile()); MarkupModelEx markupModel = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); List<String> events = new ArrayList<>(); addMarkupListener(markupModel, events); List<String> expected = new ArrayList<>(); RangeHighlighter highlighter = markupModel.addRangeHighlighter(1, 2, 0, null, HighlighterTargetArea.EXACT_RANGE); assertEventsFired(expected, events, "(1,2): AA"); RangeHighlighter highlighter2 = markupModel.addRangeHighlighter(2, 3, 0, null, HighlighterTargetArea.EXACT_RANGE); assertEventsFired(expected, events, "(2,3): AA"); markupModel.removeAllHighlighters(); assertEventsFired(expected, events, "(1,2): BR", "(1,2): AR", "(2,3): BR", "(2,3): AR"); assertFalse(highlighter.isValid()); assertFalse(highlighter2.isValid()); assertEmpty((markupModel.getAllHighlighters())); }