@Override public void afterProcess(T item, @Nullable S result) { try { delegate.afterProcess(item, result); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void beforeProcess(T item) { try { delegate.beforeProcess(item); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void onProcessError(T item, Exception e) { try { delegate.onProcessError(item, e); } catch (Exception e1) { throw new BatchRuntimeException(e1); } } }
try { for (final ItemProcessListener l : itemProcessListeners) { l.beforeProcess(itemRead); l.afterProcess(itemRead, output); l.onProcessError(itemRead, e);
processListenerProxy.beforeProcess(itemRead); processListenerProxy.afterProcess(itemRead, processedItem); processListenerProxy.onProcessError(itemRead, e); } catch (Exception e1) { ExceptionConfig.wrapBatchException(e1);
@Test(expected=BatchRuntimeException.class) public void testOnProcessErrorException() throws Exception { String item = "This is the input"; Exception cause = new Exception("This was the cause"); Exception exception = new Exception("This is expected"); doThrow(exception).when(delegate).onProcessError(item, cause); adapter.onProcessError(item, cause); } }
@Test(expected=BatchRuntimeException.class) public void testAfterProcessException() throws Exception { String item = "This is the input"; String result = "This is the output"; Exception exception = new Exception("This is expected"); doThrow(exception).when(delegate).afterProcess(item, result); adapter.afterProcess(item, result); }
@Test(expected=BatchRuntimeException.class) public void testBeforeProcessException() throws Exception { Exception exception = new Exception("This should occur"); String item = "This is the bad item"; doThrow(exception).when(delegate).beforeProcess(item); adapter.beforeProcess(item); }
@Test public void testOnProcessError() throws Exception { String item = "This is the input"; Exception cause = new Exception("This was the cause"); adapter.onProcessError(item, cause); verify(delegate).onProcessError(item, cause); }
@Test public void testAfterProcess() throws Exception { String item = "This is the input"; String result = "This is the output"; adapter.afterProcess(item, result); verify(delegate).afterProcess(item, result); }
@Test public void testBeforeProcess() throws Exception { String item = "This is my item"; adapter.beforeProcess(item); verify(delegate).beforeProcess(item); }
@Override public void onProcessError(T item, Exception e) { try { delegate.onProcessError(item, e); } catch (Exception e1) { throw new BatchRuntimeException(e1); } } }
@Override public void afterProcess(T item, @Nullable S result) { try { delegate.afterProcess(item, result); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void beforeProcess(T item) { try { delegate.beforeProcess(item); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void onProcessError(T item, Exception e) { try { delegate.onProcessError(item, e); } catch (Exception e1) { throw new BatchRuntimeException(e1); } } }
@Override public void afterProcess(T item, S result) { try { delegate.afterProcess(item, result); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void beforeProcess(T item) { try { delegate.beforeProcess(item); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void onProcessError(T item, Exception e) { try { delegate.onProcessError(item, e); } catch (Exception e1) { throw new BatchRuntimeException(e1); } } }
@Override public void afterProcess(T item, @Nullable S result) { try { delegate.afterProcess(item, result); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void beforeProcess(T item) { try { delegate.beforeProcess(item); } catch (Exception e) { throw new BatchRuntimeException(e); } }