void () { Document document = EditorFactory.getInstance().createDocument("[xxxxxxxxxxxxxx]"); MarkupModel markupModel = DocumentMarkupModel.forDocument(document, getProject(), true); RangeMarker m = markupModel.addRangeHighlighter(null, 1, 6, 0, HighlighterTargetArea.EXACT_RANGE); assertTrue(m.isValid()); markupModel.removeAllHighlighters(); assertFalse(m.isValid()); assertEmpty(markupModel.getAllHighlighters()); m.dispose(); assertFalse(m.isValid()); }