Error messages explained


Did EqualsVerifier give an error message that you didn’t understand? I try to make the error messages as clear as possible, but unfortunately Java’s stacktraces leave little room for explanation sometimes. This page should help make sense of some of EqualsVerifier’s error messages. Note that this is not intended to be an exhaustive list, buf if you found a message confusing please let me know.

Before you continue, please check your class’s toString method. Since EqualsVerifier relies on toString when generating error messages, overriding it helps with getting better error messages. I recommend including the name of the class, and a summary of all the fields relevant to the equals contract. For example:

@Override public String toString() {
    return getClass().getSimpleName() + ": x=" + x + ", y=" + y;
// "Point: x=1, y=2"

The error messages

This is not a complete list. I’ll add to it as needed, so if you need help with an error message, please file an issue or let me know on the discussion group, and I’ll add an explanation as soon as possible.