Search⌘ K
AI Features

AssertJ

Explore the AssertJ library to write expressive and fluent assertions enhancing your JUnit 5 tests. Understand its key modules and setup with Maven or Gradle, and learn how to use assertThat for multiple assertions and clear error messages.

AssertJ is a Java library used alongside JUnit 5 to write fluent assertions.

AssertJ contains feature-rich assertions and helpful error messages. This improves test code readability, and helps us debug failed unit tests.

Different modules of AssertJ

AssertJ is composed of several modules:

  • Core Module - This module provides assertions for JDK types (String, Iterable, Stream, Path, File, Map, etc.) ...