@Test public void testHeadings() throws UIMAException { final JCas jCas = JCasSingleton.getJCasInstance(); final StructuralAnnotations sa = new StructuralAnnotations(); final Element h1 = new Element(Tag.valueOf("h1"), ""); final Element h2 = new Element(Tag.valueOf("h2"), ""); final Element h3 = new Element(Tag.valueOf("h3"), ""); final Element h4 = new Element(Tag.valueOf("h4"), ""); final AnnotationCollector collector = new AnnotationCollector(); sa.map(jCas, h1, collector); sa.map(jCas, h2, collector); sa.map(jCas, h3, collector); sa.map(jCas, h4, collector); Heading heading1 = (Heading) collector.getAnnotations().get(0); Heading heading2 = (Heading) collector.getAnnotations().get(1); Heading heading3 = (Heading) collector.getAnnotations().get(2); Heading heading4 = (Heading) collector.getAnnotations().get(3); assertEquals(1, heading1.getLevel()); assertEquals(2, heading2.getLevel()); assertEquals(3, heading3.getLevel()); assertEquals(4, heading4.getLevel()); }
} else if (s instanceof Heading) { final Heading h = (Heading) s; final int level = Math.min(6, Math.max(1, h.getLevel())); e = createElement("h" + level); } else if (s instanceof Link) {