use of org.assertj.core.internal.objects.data.Person in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_bddSoftAssertions_Test method should_pass_with_bdd_soft_assertions.
@Test
void should_pass_with_bdd_soft_assertions() {
// GIVEN
Person actual = new Person("John");
actual.home.address.number = 1;
Person expected = new Person("John");
expected.home.address.number = 1;
// WHEN
softly.then(actual).usingRecursiveComparison().isEqualTo(expected);
// THEN
softly.assertAll();
}
use of org.assertj.core.internal.objects.data.Person in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_isEqualTo_Test method should_fail_when_actual_is_not_null_and_expected_is.
@Test
void should_fail_when_actual_is_not_null_and_expected_is() {
// GIVEN
Person actual = new Person();
Person expected = null;
// WHEN
compareRecursivelyFailsAsExpected(actual, expected);
// THEN
verify(failures).failure(info, shouldBeEqual(actual, null, objects.getComparisonStrategy(), info.representation()));
}
use of org.assertj.core.internal.objects.data.Person in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_isEqualTo_Test method should_fail_when_actual_is_null_and_expected_is_not.
@Test
void should_fail_when_actual_is_null_and_expected_is_not() {
// GIVEN
Person actual = null;
Person expected = new Person();
// WHEN
compareRecursivelyFailsAsExpected(actual, expected);
// THEN
verify(failures).failure(info, shouldNotBeNull());
}
use of org.assertj.core.internal.objects.data.Person in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_isEqualTo_Test method recursivelyEqualObjects.
private static Stream<Arguments> recursivelyEqualObjects() {
Person person1 = new Person("John");
person1.home.address.number = 1;
Person person2 = new Person("John");
person2.home.address.number = 1;
Person person3 = new Person("John");
person3.home.address.number = 1;
Human person4 = new Human();
person4.name = "John";
person4.home.address.number = 1;
return Stream.of(arguments(person1, person2, "same data, same type"), arguments(person2, person1, "same data, same type reversed"), arguments(person3, person4, "same data, different type"), arguments(new Theme(RED), new Theme(RED), "same data with enum overriding methods - covers #1866"), arguments(person4, person3, "same data, different type"));
}
use of org.assertj.core.internal.objects.data.Person in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_isEqualTo_Test method should_be_able_to_compare_objects_with_direct_cycles.
@Test
void should_be_able_to_compare_objects_with_direct_cycles() {
// GIVEN
Person actual = new Person("John");
actual.home.address.number = 1;
Person expected = new Person("John");
expected.home.address.number = 1;
// neighbour
expected.neighbour = actual;
actual.neighbour = expected;
// THEN
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
}
Aggregations