Hello,
Can anyone recommend a decent way to test Skip Listeners? I'd like to test my processors and writers and include skip logic as part of my testing.
Thanks,
Alejandro
Printable View
Hello,
Can anyone recommend a decent way to test Skip Listeners? I'd like to test my processors and writers and include skip logic as part of my testing.
Thanks,
Alejandro
Just bumping this topic... If there is no real way to do this outside of the framework, I guess I could just call onSkipInXXX() inside of a try catch within a junit.
But I'd like to hear if there is a better way.
As a "component test", you should just call onSkipInX() directly within the test method. Then you can verify that the method does what you want.
As a "functional test", to test the interaction between your components, you can set up a sort of dummy job or dummy step and inject the things you want to test. Then you can set up a condition that throws an exception from your processor/writer and check that the skiplistener is called. To get some ideas of ways to do this, you might want to take a look at the junit tests in spring-batch-core.