CompositeBatchListener implements BatchListener<P> { @Override public void onBatchWritingException(Batch<P> batch, Throwable throwable) { for (ListIterator<BatchListener<P>> iterator = listeners.listIterator(listeners.size()); iterator.hasPrevious();) { iterator.previous().onBatchWritingException(batch, throwable); } } CompositeBatchListener();  CompositeBatchListener(List<BatchListener<P>> listeners); @Override void beforeBatchReading(); @Override void afterBatchProcessing(Batch<P> batch); @Override void afterBatchWriting(Batch<P> batch); @Override void onBatchWritingException(Batch<P> batch, Throwable throwable); void addBatchListener(final BatchListener<P> batchListener);  }
@Test public void testOnBatchWritingException() { compositeBatchListener.onBatchWritingException(batch, exception); InOrder inOrder = inOrder(batchListener1, batchListener2); inOrder.verify(batchListener2).onBatchWritingException(batch, exception); inOrder.verify(batchListener1).onBatchWritingException(batch, exception); }