CollectionProcessingEngine cpe = setupCpm(documentCount, "AnnotatorProcessException",
exceptionSequence, "process");
// Create and register a Status Callback Listener
TestStatusCallbackListener listener = new CollectionReaderStatusCallbackListener(cpe);
cpe.addStatusCallbackListener(listener);
cpe.process();
// wait until cpm has finished
while (!listener.isFinished() && !listener.isAborted()) {
Thread.sleep(5);
}