I've got a complicated batch application, and I want to test that my assumptions about flow are correct.
Here's a much simplified version of what I'm working with:
<beans>
<batch:job id="job1">
<batch:step id="step1" next="step2">
<batch:tasklet ref="someTask1"/>
</batch:step>
<batch:step id="step2.master">
<batch:partition partitioner="step2Partitioner"
step="step2" />
<batch:next on="*" to="step3" />
<batch:next on="FAILED" to="step4" />
</batch:step>
<batch:step id="step3" next="step3">
<batch:tasklet ref="someTask1"/>
</batch:step>
<batch:step id="step4" next="step4">
<batch:tasklet ref="someTask1"/>
</batch:step>
</batch:job>
<batch:job id="job2">
<batch:step id="failingStep">
<batch:tasklet ref="failingTasklet"/>
</batch:step>
</batch:job>
<bean id="step2Partitioner" class="org.springframework.batch.core.partition.support.MultiResourcePartitioner" scope="step">
<property name="resources" value="file:${file.test.resources}/*" />
</bean>
<bean id="step2" class="org.springframework.batch.core.step.job.JobStep">
<property name="job" ref="job2" />
<property name="jobLauncher" ref="jobLauncher" />
<property name="jobRepository" ref="jobRepository" />
</bean>
</beans>
Job1 is the job I want to test. I really only want to test the transition of step2.master to step3 or step4. I don't want to test step1 at all...
However, I want to keep Job1's specification intact, since this test is testing the configuration, not the underlying actions. I already have acceptance tests to test end-to-end stuff. This example is so I can write targeted tests for small variations without creating seperate end-to-end tests for each edge case.
What I want to test is that when the job inside step2 fails, step2.master will forward me on to step 4 and not step 3. Is there a good way to test this?