Inspectopedia
 
2024.3

Test method without assertions

Warning
Reliability
New
Last modified: 03 December 2024

Reports test methods that do not contain any assertions. Such methods may indicate either incomplete or weak test cases.

Example:

Configure the inspection:

  • Use the table to specify the combinations of fully qualified class name and method name regular expression that should qualify as assertions. Class names also match subclasses.

  • Use the 'assert' keyword is considered an assertion option to specify if the Java assert statements using the assert keyword should be considered an assertion.

  • Use the Ignore test methods which declare exceptions option to ignore the test methods that declare exceptions. This can be useful when you have tests that will throw an exception on failure and thus don't need any assertions.