title: How to pass JobParameters to the Spring Batch Junit Test case JobLauncherTestUtils?
body: <p>I am newbie to the Spring Batch, I have a following main program which I want to convert it into the test case using <code>jobLauncherTestUtils</code>. How we can do that?</p>
  
  <p>I followed <a href="http://docs.spring.io/spring-batch/reference/html/testing.html" rel="nofollow noreferrer">http://docs.spring.io/spring-batch/reference/html/testing.html</a>, but I don't see any pointers. Please guide.</p>
  
  <pre><code>private void run() {
          String[] springConfig = { "spring/batch/jobs/job-extract-users.xml" };
          ApplicationContext context = new ClassPathXmlApplicationContext(springConfig);
  
          JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher");
          Job job = (Job) context.getBean("testActualJob");
  
          try {
              JobParameters param = new JobParametersBuilder().addString("age", "20").toJobParameters();
  
              JobExecution execution = jobLauncher.run(job, param);
              System.out.println("----------------------------------------------");
              System.out.println("Exit Status : " + execution.getStatus());
              System.out.println("Exit Status : " + execution.getAllFailureExceptions());
              System.out.println("-----------------------------------------------");
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          System.out.println("Done !!");
      } 
  </code></pre>