MimeReader extends BaleenCollectionReader { @Override public boolean doHasNext() throws IOException, CollectionException { return !files.isEmpty(); }  @Override boolean doHasNext(); static final String PARAM_FOLDER; }
@Test public void testMetadata() throws Exception { BaleenCollectionReader bcr = getCollectionReader(MimeReader.PARAM_FOLDER, tmpDir.toAbsolutePath().toString()); bcr.initialize(); assertTrue(bcr.doHasNext()); bcr.getNext(jCas.getCas()); AnnotationIndex<Metadata> annotationIndex = jCas.getAnnotationIndex(Metadata.class); assertEquals(X_FROM, get(annotationIndex, "email.X-From")); assertEquals(TO, get(annotationIndex, "email.X-To")); assertEquals(MESSAGE_ID, get(annotationIndex, "email.Message-ID")); bcr.close(); }
@Test public void testDocumentText() throws Exception { BaleenCollectionReader bcr = getCollectionReader(MimeReader.PARAM_FOLDER, tmpDir.toAbsolutePath().toString()); bcr.initialize(); assertTrue(bcr.doHasNext()); bcr.getNext(jCas.getCas()); assertTrue(jCas.getDocumentText().startsWith("I'm going to eat you!")); bcr.close(); }