Getting Started

Get EqualsVerifier


  • EqualsVerifier 3.x → Java 8 or higher
  • EqualsVerifier 2.x → Java 7 or higher
  • EqualsVerifier 1.x → Java 6 or higher

Prefer video?

Check out this recording from my talk at Devoxx 2017:

Prefer text?

First, add the EqualsVerifier dependency to your build script:


(please adjust for your build system of choice)

If you need to download the jar file directly, you can download it from EqualsVerifier doesn’t have any transitive dependencies, so this jar is all you need.

Use it in a test

This is what EqualsVerfier can look like in your test:

public void equalsContract() {

Chances are, EqualsVerifier will give you an error message on the first try. That might be frustrating at first, but there’s a good reason for it. There’s a surprising number of ways in which an equals method can contain bugs. Even when you let your IDE generate it, it might have problems.

These problems might not seem like a big deal, and to be honest, you might never encounter them anyway. But if you do, they can be incredibly hard to debug.

That’s why EqualsVerifier’s philosophy is to be super-strict by default. In fact, it can be frustratingly strict. But there’s a lot of ways to tweak EqualsVerifier to make it behave just the way you want it to.

Here are the most common issues you might run into on your first try:

If you still think EqualsVerifier is too strict, you can make it more lenient:

public void equalsContract() {

This way, Warning.STRICT_INHERITANCE and Warning.NONFINAL_FIELDS are automatically suppressed.

Want to learn more? Check out the manual!