@Before public void setUp() { MockitoAnnotations.initMocks(this); adapter = new ChunkListenerAdapter(delegate); }
@Test(expected=UncheckedTransactionException.class) public void testAfterChunkErrorException() throws Exception { doThrow(new Exception("This is expected")).when(delegate).afterChunk(); adapter.afterChunk(null); }
@Test(expected=BatchRuntimeException.class) public void testAfterChunkErrorNullContext() throws Exception { adapter.afterChunkError(null); }
@Test(expected=UncheckedTransactionException.class) public void testBeforeChunkException() throws Exception { doThrow(new Exception("This is expected")).when(delegate).beforeChunk(); adapter.beforeChunk(null); }
@Test public void testBeforeChunk() throws Exception { adapter.beforeChunk(null); verify(delegate).beforeChunk(); }
@Test(expected=IllegalArgumentException.class) public void testNullDelegate() { adapter = new ChunkListenerAdapter(null); }
@Test(expected=UncheckedTransactionException.class) public void testAfterChunkException() throws Exception { doThrow(new Exception("This is expected")).when(delegate).afterChunk(); adapter.afterChunk(null); }
@Test public void testAfterChunkError() throws Exception { Exception exception = new Exception("This was expected"); when(context.getAttribute(org.springframework.batch.core.ChunkListener.ROLLBACK_EXCEPTION_KEY)).thenReturn(exception); adapter.afterChunkError(context); verify(delegate).onError(exception); } }
ChunkListener chunkListener = new ChunkListenerAdapter((javax.batch.api.chunk.listener.ChunkListener) listener); chunkListeners.add(chunkListener);
@Test public void testAfterChunk() throws Exception { adapter.afterChunk(null); verify(delegate).afterChunk(); }
ChunkListener chunkListener = new ChunkListenerAdapter((javax.batch.api.chunk.listener.ChunkListener) listener); chunkListeners.add(chunkListener);
ChunkListener chunkListener = new ChunkListenerAdapter((javax.batch.api.chunk.listener.ChunkListener) listener); chunkListeners.add(chunkListener);
ChunkListener chunkListener = new ChunkListenerAdapter((javax.batch.api.chunk.listener.ChunkListener) listener); chunkListeners.add(chunkListener);