### Question:
BioAdiAbreviationAnnotator extends JCasAnnotator_ImplBase { @Override public void process(JCas aJCas) throws AnalysisEngineProcessException { String text = aJCas.getDocumentText(); if (text.length() > 0) { List<String> abrevs = Utility.performTest("", text); for (String abrevArr : abrevs) { try { String[] abrev = abrevArr.split("\\|"); String shortF = abrev[0]; String longF = abrev[1]; int shortStart = text.indexOf(shortF); int longStart = text.indexOf(longF); Annotation a = new Annotation(aJCas, longStart, longStart + longF.length()); a.setComponentId(BioAdiAbreviationAnnotator.class.getName()); a.addToIndexes(); Abbreviation abr = new Abbreviation(aJCas, shortStart, shortStart + shortF.length()); abr.setDefinedHere(true); abr.setExpan(longF); abr.setTextReference(a); abr.setConfidence(abrev[2]); abr.setComponentId(BioAdiAbreviationAnnotator.class .getName()); abr.addToIndexes(); } catch (Exception e) { System.err.println("could not match abreviation, " + e); } } } }  @Override void initialize(UimaContext context); @Override void process(JCas aJCas); public String dummy; }### Answer:
@Test public void test() throws Exception { JCas jCas = getTestCas( "shunting for normal pressure hydrocephalus (NPH) was classified"); AnalysisEngine ae = createEngine(BioAdiAbreviationAnnotator.class); ae.process(jCas); Collection<Abbreviation> a = select(jCas, Abbreviation.class); Prin.t(a); assertEquals(1, a.size()); }