title: How to test a Step in a FlowJob
body: <p>I'm attempting to test a Step contained within a Flow, contained in within a Job. Here's the basic Job configuration:</p>
  
  <pre><code>    Flow readFlow = new FlowBuilder&lt;Flow&gt;("readFlow").start(step01.deleteProcessedRecords()).on("*")
              .to(step02.retrieveIdentifiers())...end();
  
      Flow firstWriteFlow = new FlowBuilder&lt;Flow&gt;("firstWriteFlow").from(step04.createFirstFile()).end();
  
  
      FlowJobBuilder builder = new JobBuilder("createFiles").repository(jobRepository)
              .incrementer(new RunIdIncrementer())
              .start(readFlow)
              .on("*")
              .to(firstWriteFlow)
              .end(); 
  </code></pre>
  
  <p>I will make the flows more complex, they have been simplified for the sake of example. When I execute the following test I get an error:</p>
  
  <pre><code>    JobParameters jobParameters = new JobParametersBuilder()
              .addString("runId", "Step01").toJobParameters();
  
  
      JobExecution exec = jobLauncherTestUtils
              .launchStep("deleteProcessedRecords", jobParameters);
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>java.lang.IllegalStateException: No Step found with name: [deleteProcessedRecords]
  </code></pre>
  
  <p>However, if I test the Job, the step is clearly there:</p>
  
  <pre><code>JobParameters jobParameters = new JobParametersBuilder()
              .addString("runId", "Step01").toJobParameters();
  
  
      JobExecution exec = jobLauncherTestUtils
              .launchJob(jobParameters);
  </code></pre>
  
  <p>success:</p>
  
  <pre><code>2016-05-09 17:34:47.387  INFO 16748 --- [           main] o.s.b.c.l.support.SimpleJobLauncher      : Job: [FlowJob: [name=createFiles]] launched with the following parameters: [{runId=Step01}]
  2016-05-09 17:34:47.450  INFO 16748 --- [           main] o.s.batch.core.job.SimpleStepHandler     : Executing step: [deleteProcessedRecords]
  2016-05-09 17:34:47.699  INFO 16748 --- [           main] o.s.batch.core.job.SimpleStepHandler     : Executing step: [retrieveIdentifiers]
  </code></pre>
  
  <p>I've checked the documentation <a href="http://docs.spring.io/spring-batch/reference/html/testing.html#endToEndTesting" rel="nofollow">for Unit Testing</a> which seem to indicate I should just be able to pass in the Step name. Can anyone show me how to properly test a Step or if I'm doing something incorrectly? Thanks in advance,</p>
  
  <p>Sergio. </p>
  
  <p>EDIT:</p>
  
  <p>As requested, here's the step:</p>
  
  <pre><code>@Autowired
  private DeleteProcessedRecordsTasklet deleteProcessedRecordsTasklet;
  
  @Bean
  public Step deleteProcessedRecords() {
      return stepBuilderFactory.get("deleteProcessedRecords")
              .tasklet(deleteProcessedRecordsTasklet)
              .build();
  }
  </code></pre>
  
  <p>I am using spring-batch-core version 3.0.7.RELEASE, part of spring-boot-starter-batch 1.3.5.RELEASE </p>