Search code examples
javaspringspring-bootjunitjunit4

How to start Spring Boot server with ClassRule in JUnit4?


As I can see the there is the org.springframework.test.context.junit4.rules.SpringClassRule that is a ClassRule's equivalent to the org.springframework.test.context.junit4.SpringJUnit4ClassRunner.

However, I'd like to boot up my whole Spring Boot application with a ClassRule. Is there something like org.springframework.boot.test.contextSpringBootTest as a ClassRule?


Solution

  • There is a GitHub project that solves this issue: https://github.com/CarloWakefield/spring-boot-test-rule