Hamcrest

Learn to use the Hamcrest library along with JUnit 5.

Similar to AssertJ, Hamcrest provides a set of assertions that read like English sentences.

It’s a well-known library used to write assertions for our unit tests. It was developed for Java, and later adopted by multiple other languages, such as Python, Ruby, PHP, Javascript, and Golang.

Getting started with Hamcrest

To install Hamcrest, we use the following Maven coordinates.

Get hands-on with 1200+ tech skills courses.