Cookbook Name:
JUnit 4 Best Practices
Description:
Best practices for the JUnit 4 testing framework including correct usage of its API and annotations.
Owner:
Secure Code Warrior
Number of Recipes:
9
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/JUnit4
JUnit 4: @Ignored Description Add a description to indicate why the test has been ignored. java warning testingframework specificJUnit 4quality
JUnit 4: @Test annotation missing Method with assertions is missing @Test annotation java error testingframework specificJUnit 4quality
JUnit 4: Incorrect method signature for annotation The annotations on this method require it to have a void return type and not be private. javakotlin error testingframework specificJUnit 4quality
JUnit 4: Incorrect method signature for annotation (Class - arguments) The annotations on this method require it to have no arguments. java error testingframework specificJUnit 4quality
JUnit 4: Incorrect method signature for annotation (Class) The annotations on this method require it to have a void return type, not be private, and be static. javakotlin error testingframework specificJUnit 4quality
JUnit 4: assertEquals suspicious order of arguments (with message) Suspicious argument values for 'expected' and 'actual' java warning testingframework specificJUnit 4quality
JUnit 4: assertEquals suspicious order of arguments (with message) Suspicious argument values for 'expected' and 'actual' java warning testingframework specificJUnit 4quality
Test framework: Enforce @Rule annotation for a JUnitSoftAssertions field A JUnitSoftAssertions field always need to have the @Rule annotation java error testingframework specificJUnit 4quality
Markdown badge: