CompositeRecordWriterListener implements RecordWriterListener<P> { @Override public void onRecordWritingException(Batch<P> batch, Throwable throwable) { for (ListIterator<RecordWriterListener<P>> iterator = listeners.listIterator(listeners.size()); iterator.hasPrevious();) { iterator.previous().onRecordWritingException(batch, throwable); } } 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 testOnRecordWritingException() { compositeRecordWriterListener.onRecordWritingException(batch, exception); InOrder inOrder = inOrder(recordWriterListener1, recordWriterListener2); inOrder.verify(recordWriterListener2).onRecordWritingException(batch, exception); inOrder.verify(recordWriterListener1).onRecordWritingException(batch, exception); }