@Test public void testMain() throws UIMAException { JCas jCas = JCasSingleton.getJCasInstance(); SemanticHtml sa = new SemanticHtml(); Map<String, Class<?>> expectedMain = new HashMap<>(); expectedMain.put("time", Temporal.class); expectedMain.put("meter", Quantity.class); expectedMain.put("dfn", Buzzword.class); expectedMain.put("address", Location.class); expectedMain.put("abbr", Buzzword.class); expectedMain.put("cite", DocumentReference.class); for (Map.Entry<String, Class<?>> e : expectedMain.entrySet()) { Element element = new Element(Tag.valueOf(e.getKey()), ""); AnnotationCollector collector = new AnnotationCollector(); sa.map(jCas, element, collector); if (e.getValue() != null) { assertTrue(e.getValue().isInstance(collector.getAnnotations().get(0))); } else { assertNull(collector.getAnnotations()); } } }
@Override public void map(JCas jCas, Element element, AnnotationCollector collector) { switch (element.tagName().toLowerCase()) { case "time": collector.add(new Temporal(jCas)); break; case "meter": collector.add(new Quantity(jCas)); break; case "dfn": collector.add(new Buzzword(jCas)); break; case "address": collector.add(new Location(jCas)); break; case "abbr": collector.add(new Buzzword(jCas)); break; case "cite": collector.add(new DocumentReference(jCas)); break; default: return; } }
SemanticHtml implements ContentMapper { @Override public void map(JCas jCas, Element element, AnnotationCollector collector) { switch (element.tagName().toLowerCase()) { case "time": collector.add(new Temporal(jCas)); break; case "meter": collector.add(new Quantity(jCas)); break; case "dfn": collector.add(new Buzzword(jCas)); break; case "address": collector.add(new Location(jCas)); break; case "abbr": collector.add(new Buzzword(jCas)); break; case "cite": collector.add(new DocumentReference(jCas)); break; default: return; } } }
SemanticHtml implements ContentMapper { @Override public void map(JCas jCas, Element element, AnnotationCollector collector) { switch (element.tagName().toLowerCase()) { case "time": collector.add(new Temporal(jCas)); break; case "meter": collector.add(new Quantity(jCas)); break; case "dfn": collector.add(new Buzzword(jCas)); break; case "address": collector.add(new Location(jCas)); break; case "abbr": collector.add(new Buzzword(jCas)); break; case "cite": collector.add(new DocumentReference(jCas)); break; default: return; } }  }
SemanticHtml implements ContentMapper { @Override public void map(JCas jCas, Element element, AnnotationCollector collector) { switch (element.tagName().toLowerCase()) { case "time": collector.add(new Temporal(jCas)); break; case "meter": collector.add(new Quantity(jCas)); break; case "dfn": collector.add(new Buzzword(jCas)); break; case "address": collector.add(new Location(jCas)); break; case "abbr": collector.add(new Buzzword(jCas)); break; case "cite": collector.add(new DocumentReference(jCas)); break; default: return; } }  @Override void map(JCas jCas, Element element, AnnotationCollector collector); }
SemanticHtml implements ContentMapper { @Override public void map(JCas jCas, Element element, AnnotationCollector collector) { switch (element.tagName().toLowerCase()) { case "time": collector.add(new Temporal(jCas)); break; case "meter": collector.add(new Quantity(jCas)); break; case "dfn": collector.add(new Buzzword(jCas)); break; case "address": collector.add(new Location(jCas)); break; case "abbr": collector.add(new Buzzword(jCas)); break; case "cite": collector.add(new DocumentReference(jCas)); break; default: return; } }  @Override void map(JCas jCas, Element element, AnnotationCollector collector);  }