CompositeRecordWriter implements RecordWriter<P> { @Override public void writeRecords(Batch<P> batch) throws Exception { for (RecordWriter<P> writer : writers) { writer.writeRecords(batch); } } CompositeRecordWriter(List<RecordWriter<P>> writers); @Override void open(); @Override void writeRecords(Batch<P> batch); @Override void close();  }
@Test public void testWriteRecords() throws Exception { compositeRecordWriter.writeRecords(batch); InOrder inOrder = inOrder(recordWriter1, recordWriter2); inOrder.verify(recordWriter1).writeRecords(batch); inOrder.verify(recordWriter2).writeRecords(batch); }