Back to Intellij Community

AssertWithoutMessage

java/java-impl/resources/inspectionDescriptions/AssertWithoutMessage.html

2025.3-rc-2407 B
Original Source

Reports calls to assertXXX() or fail() without an error message string argument. An error message on assertion failure may help clarify the test case's intent.

Example:

assertTrue(checkValid());

After the quick-fix is applied:

assertTrue(checkValid(), "|");

The message argument is added before or after the existing arguments according to the assertions framework that you use.