CompositeRecordWriterListener implements RecordWriterListener<P> { @Override public void beforeRecordWriting(Batch<P> batch) { for (RecordWriterListener<P> listener : listeners) { listener.beforeRecordWriting(batch); } } CompositeRecordWriterListener();  CompositeRecordWriterListener(List<RecordWriterListener<P>> listeners); @Override void beforeRecordWriting(Batch<P> batch); @Override void afterRecordWriting(Batch<P> batch); @Override void onRecordWritingException(Batch<P> batch, Throwable throwable); void addRecordWriterListener(RecordWriterListener<P> recordWriterListener);  }
@Test public void testBeforeRecordWriting() { compositeRecordWriterListener.beforeRecordWriting(batch); InOrder inOrder = inOrder(recordWriterListener1, recordWriterListener2); inOrder.verify(recordWriterListener1).beforeRecordWriting(batch); inOrder.verify(recordWriterListener2).beforeRecordWriting(batch); }