@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); adapter = new ItemProcessListenerAdapter<>(delegate); }
@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(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 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(expected=IllegalArgumentException.class) public void testNullCreation() { adapter = new ItemProcessListenerAdapter<>(null); }
@Test public void testBeforeProcess() throws Exception { String item = "This is my item"; adapter.beforeProcess(item); verify(delegate).beforeProcess(item); }
@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); }
ItemProcessListener<I,O> itemListener = new ItemProcessListenerAdapter<>((javax.batch.api.chunk.listener.ItemProcessListener) listener); processListeners.add(itemListener);
ItemProcessListener<I,O> itemListener = new ItemProcessListenerAdapter<I, O>((javax.batch.api.chunk.listener.ItemProcessListener) listener); processListeners.add(itemListener);
ItemProcessListener<I,O> itemListener = new ItemProcessListenerAdapter<I, O>((javax.batch.api.chunk.listener.ItemProcessListener) listener); processListeners.add(itemListener);
ItemProcessListener<I,O> itemListener = new ItemProcessListenerAdapter<I, O>((javax.batch.api.chunk.listener.ItemProcessListener) listener); processListeners.add(itemListener);