Inspectopedia Help

Test method without assertions

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

Example:

public class ExtensiveTest { @Test public void testAlive() { System.out.println("nothing"); } }

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.

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

None

'assert' keyword is considered an assertion

Not selected

Ignore test methods which declare exceptions

Not selected

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.16690

Last modified: 29 April 2024