0

I am working on Spring Batch Unit test and every time I run my test-case I am getting job name as "TestJob". Is it possible to set/alter this and provide a new job name?

I tried and worked around:

jobLauncherTestUtils.setJob()

but could find anything helpful.

Sankalpa Wijewickrama
  • 985
  • 3
  • 19
  • 30

1 Answers1

0

It seems you are launching a single step in isolation. In this case, a surrounding job named "TestJob" is created to wrap the step under test, see How is job name getting assigned in spring batch junit. It see no obvious way to change it.

But in my opinion, when testing a single step in isolation, the surrounding job name should not really matter.

Mahmoud Ben Hassine
  • 28,519
  • 3
  • 32
  • 50
  • Actually I need job name as one of the inputs to the database procedure. I know I can mock dao layer, but wondering how to get actual job name. BTW thank you for the answer. :) – Sachin Koparde Apr 01 '22 at 09:03