use of org.springframework.batch.core.step.builder.StepBuilder in project hub-alert by blackducksoftware.
the class CommonConfigTest method testCreateStep.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testCreateStep() {
final StepBuilderFactory stepBuilderFactory = Mockito.mock(StepBuilderFactory.class);
final TaskExecutor taskExecutor = Mockito.mock(TaskExecutor.class);
final PlatformTransactionManager transactionManager = Mockito.mock(PlatformTransactionManager.class);
final C config = getConfigWithParams(stepBuilderFactory, taskExecutor, transactionManager);
final R reader = getMockReader();
final P processor = getMockProcessor();
final W writer = getMockWriter();
final StepBuilder stepBuilder = Mockito.mock(StepBuilder.class);
final SimpleStepBuilder simpleStepBuilder = Mockito.mock(SimpleStepBuilder.class);
final AbstractTaskletStepBuilder abstractTaskletStepBuilder = Mockito.mock(AbstractTaskletStepBuilder.class);
Mockito.when(stepBuilderFactory.get(Mockito.anyString())).thenReturn(stepBuilder);
Mockito.when(stepBuilder.chunk(Mockito.anyInt())).thenReturn(simpleStepBuilder);
Mockito.when(simpleStepBuilder.reader(reader)).thenReturn(simpleStepBuilder);
Mockito.when(simpleStepBuilder.processor(processor)).thenReturn(simpleStepBuilder);
Mockito.when(simpleStepBuilder.writer(writer)).thenReturn(simpleStepBuilder);
Mockito.when(simpleStepBuilder.taskExecutor(taskExecutor)).thenReturn(abstractTaskletStepBuilder);
Mockito.when(abstractTaskletStepBuilder.transactionManager(transactionManager)).thenReturn(abstractTaskletStepBuilder);
Mockito.when(abstractTaskletStepBuilder.build()).thenReturn(new TaskletStep());
final Step step = config.createStep(reader, processor, writer);
assertNotNull(step);
}
Aggregations