### Question:
MongoCollectionRemover extends JCasCollectionReader_ImplBase { public static void removeAnnotations(String[] conn, String... annotationsToDelete) throws UIMAException, IOException { CollectionReader cr = createReader( MongoCollectionRemover.class, PARAM_DB_CONNECTION, conn, PARAM_DELETE_ANNOTATIONS, annotationsToDelete); AnalysisEngine noAE = AnalysisEngineFactory .createEngine(StatsAnnotatorPlus.class); SimplePipeline.runPipeline(cr, noAE); LOG.debug("done removing annotations"); }  @Override void initialize(UimaContext context); @Override boolean hasNext(); @Override void getNext(JCas jCas); @Override Progress[] getProgress(); static void removeAnnotations(String[] conn,
			String... annotationsToDelete); static final String PARAM_DELETE_ANNOTATIONS; }### Answer:
@Test public void test() throws Exception { String[] conn = MongoTest.getTestConn("MongoCollectionRemoverTest"); LOG.debug("using conn {}", conn); LOG.debug("PUT SOME INITIAL DATA, WITH TOKENS"); JCas jCas = getTestCas(); setDocId(jCas, 17); PipelineBuilder pO = new JcasPipelineBuilder(jCas); pO.add(NaiveSentenceSplitterAnnotator.class); pO.add(WhitespaceTokenizerAnnotator.class); pO.add(MongoWriter.class, PARAM_DB_CONNECTION, conn); pO.process(); sleep(1000); LOG.debug("GET AND VERIFIES IT HAS TOKEN ANNOT"); List<JCas> l = asList(createReader( MongoCollectionReader.class, PARAM_DB_CONNECTION, conn)); assertEquals(1, l.size()); jCas = l.get(0); Collection<Token> t = select(jCas, Token.class); assertEquals(24, t.size()); LOG.debug("REMOVE ALL TOKEN ANNOT"); MongoCollectionRemover.removeAnnotations(conn, Token.class.getName()); LOG.debug("GET AGAIN AND TEST IF IT REMOVED ALL TOKENS"); List<JCas> l2 = asList(createReader( MongoCollectionReader.class, PARAM_DB_CONNECTION, conn)); assertEquals(1, l2.size()); jCas = l2.get(0); assertEquals(17, getHeaderIntDocId(jCas)); assertFalse(JCasUtil.exists(jCas, Token.class)); }