title: Triggering Spring batch jobs in JUnit test cases
body: <p><strong>The Background :</strong></p>
  
  <p>I am currently working on an application that uses Spring Batch to read a set of files and cache the contents of the file in memory. The cached data is then used by the business logic layer that is divided into different classes, each performing a specific business functionality by using the data from the cache. </p>
  
  <p><strong>The requirement</strong> :</p>
  
  <p>I have been assigned the task to unit test the business logic layer. Since the business logic layer assumes that the data will be available in the cache, I need a way to trigger the Spring batch job in my unit tests before I can test a business logic class. </p>
  
  <p><strong>The question :</strong></p>
  
  <p>I am thinking of writing a parent JUnit class that will be extended by all JUnit classes that test the business logic. This parent JUnit class will trigger the Spring batch job to load the cache in the setUp method. </p>
  
  <ol>
  <li><p>What would be the best way to trigger the Spring batch job in the parent JUnit class? </p></li>
  <li><p>Can my parent JUnit class in the src/test/java folder be able to  access the Spring job context files in the src/main/resources/META-INF folder? </p></li>
  </ol>
  
  <p>Note that the objective is to test the classes that will use the work done by Spring batch rather than testing Spring batch jobs itself. </p>