StringRecordWriter implements RecordWriter<P> { @Override public void writeRecords(Batch<P> batch) { for (Record<P> record : batch) { stringWriter.write(record.getPayload().toString()); stringWriter.write(Utils.LINE_SEPARATOR); } stringWriter.flush(); } StringRecordWriter(final StringWriter stringWriter); @Override void writeRecords(Batch<P> batch); @Override void close();  }
@Test public void testWriteRecord() { stringRecordWriter.writeRecords(new Batch<>(new StringRecord(null, PAYLOAD))); assertThat(stringWriter.toString()).isEqualTo(PAYLOAD + LINE_SEPARATOR); }