use of java.util.function.BiPredicate in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_isEqualTo_withFieldComparators_Test method should_use_custom_equal_over_reference_comparison.
@Test
void should_use_custom_equal_over_reference_comparison() {
// GIVEN
Foo actual = new Foo(1);
Foo expected = new Foo(1);
BiPredicate<Integer, Integer> greaterThan = (i1, i2) -> Objects.equals(i1, i2 + 1);
// WHEN
AssertionError assertionError = expectAssertionError(() -> assertThat(actual).usingRecursiveComparison().withEqualsForFields(greaterThan, "bar").isEqualTo(expected));
// THEN
then(assertionError).hasMessageContainingAll("- these fields were compared with the following comparators:", " - bar -> ");
}
Aggregations