2021-03-26

Using JUnit 5 in Spring Boot 1.5.18/1.5.19?

 

Source URL: https://stackoverflow.com/a/48031452

To migrate from JUnit 4 to JUnit 5 you can replace @RunWith(SpringRunner.class) with @ExtendWith(SpringExtension.class).

Unfortunately, spring-boot version 1.5.9-RELEASE is based on Spring 4 and the SpringExtension is only available since Spring 5.

However, there is a solution since it's possible to use JUnit 5 and SpringExtension in Spring 4 by using spring-test-junit5. Just check the instructions for setting up the dependencies.


Billson@20210326_pm034909 : verified that Spring 4 is still using by Spring Boot 1.5.18/1.5.19







after downgrade/upgrade code, then also need to make sure your test runner is using JUnit 4.







Note: Failed to paste printscreen with error:
'' failed to upload. Invalid response: Cannot read property 'Yd' of null





No comments:

Google Referrals