2

We have a existing project which is using Java Batch and we need to write JUnit for that. While searching I am getting examples for Spring Batch but not for Java Batch. Can someone please share an example?

Jens Piegsa
  • 7,399
  • 5
  • 58
  • 106
Rohit
  • 41
  • 1
  • 3

1 Answers1

3

If you are talking about Java batch processing based on JSR-352, then a test can be as simple as the following:

  • obtain JobOperator;
  • create job parameters (optional);
  • start the job execution by calling `JobOperator.start(jobName, jobParams);
  • wait for the job to finish;
  • verify job execution status and result, by calling methods on JobOperator

An example JUnit test in JBeret: ClosingReaderWriterTest

cheng
  • 1,076
  • 6
  • 6