assertj / doc

AssertJ new website

Home Page:https://assertj.github.io/doc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow providing BiPredicate for equals override

shollander opened this issue · comments

I like the feature that allows the user to override the equals method for comparison.
However, the current api creates unnecessary complications and appears to be a misuse of Comparator. Comparators are intended for ordering objects, not testing equality. The contract for Comparator.compareTo() doesn't even require it to be consistent with equals().
It would be simpler to allow the user to supply a BiPredicate to test for equality. This would allow users to simplify implementation (only two possible return values instead of three) and provide a cleaner api.