void () { final DefaultDomAnnotator annotator = new DefaultDomAnnotator() { @Override protected @NotNull DomElementAnnotationsManagerImpl getAnnotationsManager(final @NotNull Project project) { return myAnnotationsManager; } }; final StringBuilder s = new StringBuilder(); AnnotationSessionImpl.computeWithSession(myElement.getFile(), false, toFill -> { final MyDomElementsInspection inspection = new MyDomElementsInspection() { @Override public void checkFileElement(final @NotNull DomFileElement fileElement, final @NotNull DomElementAnnotationHolder holder) { s.append("visited"); } }; annotator.runInspection(inspection, myElement, toFill); assertEquals("visited", s.toString()); final DomElementsProblemsHolderImpl holder = assertNotEmptyHolder(myAnnotationsManager.getProblemHolder(myElement)); assertEmpty(toFill); annotator.runInspection(inspection, myElement, toFill); assertEquals("visited", s.toString()); assertSame(holder, assertNotEmptyHolder(myAnnotationsManager.getProblemHolder(myElement))); assertEmpty(toFill); return null; }); }