diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/JobExecutionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/JobExecutionTests.java index 62fa51346..e2dbefc34 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/JobExecutionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/JobExecutionTests.java @@ -172,6 +172,15 @@ public class JobExecutionTests { assertEquals(1, execution.getStepExecutions().size()); } + @Test + public void testStepExecutionsWithSameName() throws Exception { + assertEquals(0, execution.getStepExecutions().size()); + execution.createStepExecution("step"); + assertEquals(1, execution.getStepExecutions().size()); + execution.createStepExecution("step"); + assertEquals(2, execution.getStepExecutions().size()); + } + @Test public void testSetStepExecutions() throws Exception { assertEquals(0, execution.getStepExecutions().size()); @@ -179,6 +188,15 @@ public class JobExecutionTests { assertEquals(1, execution.getStepExecutions().size()); } + @Test + public void testSetStepExecutionsWithIds() throws Exception { + assertEquals(0, execution.getStepExecutions().size()); + new StepExecution("step", execution, 1L); + assertEquals(1, execution.getStepExecutions().size()); + new StepExecution("step", execution, 2L); + assertEquals(2, execution.getStepExecutions().size()); + } + @Test public void testStop() throws Exception { StepExecution stepExecution = execution.createStepExecution("step");