Feature summary
Often times, classes define specialized equality methods that have different semantics than Object#equals. It would be nice to be able to reference these directly via a BiPredicate<T, T> and have it work with isEqualTo and other relevant methods.
Example
assertThat(actual)
.usingEqualityMethod((x, y) -> x.equalsStrict(y))
.isEqualTo(expected);
// or
assertThat(actual)
.usingEqualityMethod(MyObject::equalsStrict)
.isEqualTo(expected);
I can currently hack around this by (ab)using usingComparator, but it's not ideal.
assertThat(actual)
.usingComparator((x, y) -> x.equalsStrict(y) ? 0 : -1)
.isEqualTo(expected)
Feature summary
Often times, classes define specialized equality methods that have different semantics than
Object#equals. It would be nice to be able to reference these directly via aBiPredicate<T, T>and have it work withisEqualToand other relevant methods.Example
I can currently hack around this by (ab)using
usingComparator, but it's not ideal.