Test method without assertions
Reports test methods that do not contain any assertions. Such methods may indicate either incomplete or weak test cases.
Example:
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
TestMethodWithoutAssertion- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
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
assertstatements using theassertkeyword 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.
Inspection options
Here you can find the description of settings available for the Test method without assertions inspection, and the reference of their default values.
- Assertion methods
Default value:
None- 'assert' keyword is considered an assertion
Default value:
Not selected- Ignore test methods which declare exceptions
Default value:
Not selected
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |