Cookbook Name:
JUnit 5 Best Practices
Description:
Best practices for the JUnit 5 testing framework including correct usage of its API and annotations.
Owner:
Secure Code Warrior
Number of Recipes:
12
Recipe Name Description Language Level Tags
Testing/JUnit
JUnit: Mixed use of JUnit versions This class is using multiple versions of JUnit. Consider standardizing to the latest JUnit version, and/or to AssertJ for assertions. java warning JUnittestingframework specificJUnit 4JUnit 5quality
Testing/JUnit/JUnit5
JUnit 5: @Disabled Description Add a description to indicate why the test has been disabled. java warning testingframework specificJUnit 5quality
JUnit 5: @Nested annotation missing Inner classes that contain test information should be marked with the @Nested annotation java error testingframework specificJUnit 5quality
JUnit 5: @Nested annotation unnecessary @Nested is only needed on nested classes java warning testingframework specificJUnit 5quality
JUnit 5: @Nested annotation unnecessary There is no test information in this nested class. java warning testingframework specificJUnit 5quality
JUnit 5: @Test annotation missing Method with assertions is missing @Test annotation java error testingframework specificJUnit 5quality
JUnit 5: Incorrect method signature for annotation (All) The annotations on this method require it to have a void return type, not be private, and be static. javakotlin error testingframework specificJUnit 5quality
JUnit 5: Incorrect method signature for annotation (Each) The annotations on this method require it to have a void return type, not be private, and not be static. javakotlin error testingframework specificJUnit 5quality
JUnit 5: MethodSourceProvider should be static Methods that return a Stream of Arguments should be as static javakotlin error testingframework specificJUnit 5quality
JUnit 5: Test method cannot be private. JUnit tests methods cannot be private. This test will not be ran as a test. javakotlin warning testingframework specificJUnit 5quality
JUnit 5: assertEquals suspicious order of arguments Suspicious argument values for 'expected' and 'actual' java warning testingframework specificJUnit 5quality
JUnit 5: assertEquals suspicious order of arguments (with message) Suspicious argument values for 'expected' and 'actual' java warning testingframework specificJUnit 5quality
Markdown badge: