### Question:
ReferencesClassifierAnnotator extends JCasAnnotator_ImplBase { public void process(JCas jCas) throws AnalysisEngineProcessException { try { for (DocumentBlock block : select(jCas, DocumentBlock.class)) { String label = classify(block.getCoveredText()); if (label.equals(LABEL_INSIDE)) { block.setLabel(SECTION_REFERENCES_ENTRY); } } } catch (Exception e) { int pmId = BlueCasUtil.getHeaderIntDocId(jCas); LOG.warn("could not perform inference on " + pmId, e); } }  @Override void initialize(UimaContext context); void process(JCas jCas); String classify(String txt); static final String DEFAULT_MODEL_NAME; }### Answer:
@Test public void test() throws Exception { JcasPipelineBuilder builder = new JcasPipelineBuilder(); builder.add(ReferencesClassifierAnnotator.class, PARAM_MODEL, DEFAULT_MODEL_NAME); for (String goldLabel : new String[] { LABEL_INSIDE, LABEL_OUTSIDE }) { double tp = 0, total = 0, filesToCheck = 20; for (File f : new File(CORPUS, goldLabel).listFiles()) { if (filesToCheck-- >= 0 && f.getName().endsWith(".txt")) { @SuppressWarnings("resource") String txt = new LineReader(new FileInputStream(f)) .getText("\n"); JCas testCas = getTestCas(txt); new DocumentBlock(testCas, 0, txt.length()).addToIndexes(); builder.process(testCas); String system = selectSingle(testCas, DocumentBlock.class) .getLabel(); if ((system == null && goldLabel.equals(LABEL_OUTSIDE)) || (system != null && system.equals(SECTION_REFERENCES_ENTRY) && goldLabel .equals(LABEL_INSIDE))) { tp++; } total++; } } double ratio = tp / total; if (!(ratio > 0.85 && ratio <= 1)) { throw new Exception("tp ratio " + ratio + " too low: " + tp + " out of total " + total); } else { LOG.debug("ratio: {}", ratio); } } }