Assertion Messages

We will learn about assertion messages and why we shouldn’t use them.

We'll cover the following

Assertion messages are code comments to improve test readability. All JUnit assert forms (classic, fail(), and assertThat()) support an optional first argument named message.

The message allows us to supply a verbose explanation of the rationale behind the assertion() in testWithWorthlessAssertionComment(line 37-40):

Get hands-on with 1200+ tech skills courses.