### Question:
LinnaeusAnnotator extends JCasAnnotator_ImplBase { @Override public void process(JCas cas) throws AnalysisEngineProcessException { String text = cas.getDocumentText(); List<Mention> mentions = matcher.match(text); for (Mention mention : mentions) { String mostProbableID = mention.getMostProbableID(); String idsToString = mention.getIdsToString(); LinnaeusSpecies species = new LinnaeusSpecies(cas); species.setBegin(mention.getStart()); species.setEnd(mention.getEnd()); species.setMostProbableSpeciesId(mostProbableID); species.setAllIdsString(idsToString); species.setAmbigous(mention.isAmbigous()); species.addToIndexes(); } }  @Override void initialize(UimaContext context); @Override void process(JCas cas); @Override void collectionProcessComplete();  }### Answer:
@Test public void test() throws Exception { String file = "/linnaeus/pmcA1239921.txt"; InputStream stream = getClass().getResourceAsStream(file); String testtext = IOUtils.toString(stream); JCas jCas = getTestCas(testtext); createLinnaeusEngine().process(jCas); Collection<LinnaeusSpecies> sps = select(jCas, LinnaeusSpecies.class); assertResultsContains(sps, "mostProbableSpeciesId", "species:ncbi:9606"); assertResultsContains(sps, "mostProbableSpeciesId", "species:ncbi:9913"); }
@Test public void test2() throws Exception { JCas jCas = getTestCas("bla bla rat bla bla"); createLinnaeusEngine().process(jCas); Collection<LinnaeusSpecies> sps = select(jCas, LinnaeusSpecies.class); assertResultsContains(sps, "mostProbableSpeciesId", "species:ncbi:10116"); }