Search in sources :

Example 1 with DefaultDomAnnotator

use of com.intellij.util.xml.impl.DefaultDomAnnotator in project intellij-community by JetBrains.

the class DomHighlightingLiteTest method testDefaultAnnotator.

public void testDefaultAnnotator() throws Throwable {
    final DefaultDomAnnotator annotator = new DefaultDomAnnotator() {

        @Override
        protected DomElementAnnotationsManagerImpl getAnnotationsManager(final DomElement element) {
            return myAnnotationsManager;
        }
    };
    final StringBuilder s = new StringBuilder();
    final ArrayList<Annotation> toFill = new ArrayList<>();
    final MyDomElementsInspection inspection = new MyDomElementsInspection() {

        @Override
        public void checkFileElement(final DomFileElement fileElement, final 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);
}
Also used : DefaultDomAnnotator(com.intellij.util.xml.impl.DefaultDomAnnotator) ArrayList(java.util.ArrayList) Annotation(com.intellij.lang.annotation.Annotation)

Aggregations

Annotation (com.intellij.lang.annotation.Annotation)1 DefaultDomAnnotator (com.intellij.util.xml.impl.DefaultDomAnnotator)1 ArrayList (java.util.ArrayList)1