@Test
public void testBatchSplit() throws Exception {
JobOperator jobOperator = BatchRuntime.getJobOperator();
Long executionId = jobOperator.start("myJob", new Properties());
JobExecution jobExecution = jobOperator.getJobExecution(executionId);
jobExecution = BatchTestHelper.keepTestAlive(jobExecution);
List<StepExecution> stepExecutions = jobOperator.getStepExecutions(executionId);
List<String> executedSteps = new ArrayList<>();
for (StepExecution stepExecution : stepExecutions) {
executedSteps.add(stepExecution.getStepName());
}
(1)
assertEquals(3, stepExecutions.size());
assertTrue(executedSteps.contains("step1"));
assertTrue(executedSteps.contains("step2"));
assertTrue(executedSteps.contains("step3"));
(2)
assertTrue(executedSteps.get(0).equals("step1") || executedSteps.get(0).equals("step2"));
assertTrue(executedSteps.get(1).equals("step1") || executedSteps.get(1).equals("step2"));
(3)
assertTrue(executedSteps.get(2).equals("step3"));
(4)
assertEquals(BatchStatus.COMPLETED, jobExecution.getBatchStatus());
}