EntityWriter { public void writeEntity(EntityMention entity) throws IOException { String id = entity.getId(); String etype = "Entity"; writtenIds.add(id); if (entity.getSpecificType() != null) { etype = (entity.getSpecificType().equals("DRUG")) ? "Medication" : "Entity"; } String line = ""; line = entity.getId() + "\t" + etype + " " + entity.getBegin() + " " + entity.getEnd() + "\t" + documentText.substring(entity.getBegin(), entity.getEnd()) + "\n"; writer.write(line); } EntityWriter(Writer writer, String documentText); Writer getFileWriter(); void setFileWriter(Writer writer); void writeEntity(EntityMention entity); void close(); boolean isWritten(EntityMention entity);  }
@Test public void testWriteEntity() throws Exception{ writer.write(ENTITY_T13); replay(writer); entityWriter.writeEntity(entityT13); verify(writer); }