FileRecordWriter implements RecordWriter<String> { @Override public void writeRecords(Batch<String> batch) throws Exception { for (Record<String> record : batch) { outputStreamWriter.write(record.getPayload()); outputStreamWriter.write(lineSeparator); } outputStreamWriter.flush(); } FileRecordWriter(final Path path); void setCharset(Charset charset); void setLineSeparator(String lineSeparator); void setHeaderCallback(HeaderCallback headerCallback); void setFooterCallback(FooterCallback footerCallback); void setAppend(boolean append); @Override void open(); @Override void writeRecords(Batch<String> batch); @Override void close();  }
@Test public void testFileWriting() throws Exception { writer.writeRecords(new Batch<>(record1, record2)); assertThat(path).hasContent("foo" + LINE_SEPARATOR + "bar" + LINE_SEPARATOR); }