DocumentWriter { public void write(JCas cas) throws IOException { String documentText = cas.getDocumentText(); writer.write(documentText + "\n"); } DocumentWriter(Writer writer); void write(JCas cas); void close();  }
@Test public void testWriteDocument() throws IOException{ writer.write(DOCUMENT_TITLE + "\n" + DOCUMENT_ABSTRACT + "\n"); replay(writer); documentWriter.write(cas); verify(writer); }