Inspectopedia
 
2024.3

JUnit 4 test can be JUnit 5

Warning
Sanity
New
Last modified: 03 December 2024

Reports JUnit 4 tests that can be automatically migrated to JUnit 5. While default runners are automatically convertible, custom runners, method- and field- rules are not and require manual changes.

Example:

After the quick-fix is applied:

This inspection requires that the JUnit 5 library is available in the classpath, and JDK 1.8 or later is configured for the project.