@SpringBatchTest
with JUnit @Nested
triggers new test context creation
#4738
Labels
@SpringBatchTest
with JUnit @Nested
triggers new test context creation
#4738
Bug description
When using
@SpringBatchTest
on a test class enclosing a@Nested
class, two separate Spring test contexts are created, one to execute the test methods in the outer class and another for the ones in the inner class.Environment
Spring Batch 5.2.1 (originally detected on Spring Batch 4.3.10)
Steps to reproduce
Expected behavior
A single test context should be available for both the outer and the inner class, like in the following example:
Workaround
Applying
@SpringBatchTest
also on the inner class prevents the creation of the additional test context:Minimal Complete Reproducible example
https://github.com/scordio/spring-boot-playground/tree/spring-batch-4738-reproducer
The text was updated successfully, but these errors were encountered: