use of org.assertj.core.internal.objects.data.PersonDto in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_for_maps_Test method should_be_directly_usable_with_maps.
@Test
// verify we don't need to cast actual to an Object as before when only Object assertions provided usingRecursiveComparison()
void should_be_directly_usable_with_maps() {
// GIVEN
Person sheldon = new Person("Sheldon");
Person leonard = new Person("Leonard");
Person raj = new Person("Rajesh");
PersonDto sheldonDto = new PersonDto("Sheldon");
PersonDto leonardDto = new PersonDto("Leonard");
PersonDto rajDto = new PersonDto("Rajesh");
Map<String, Person> actual = mapOf(entry(sheldon.getName(), sheldon), entry(leonard.getName(), leonard), entry(raj.getName(), raj));
Map<String, PersonDto> expected = mapOf(entry(sheldonDto.name, sheldonDto), entry(leonardDto.name, leonardDto), entry(rajDto.name, rajDto));
// WHEN/THEN no need to cast actual to an Object as before (since only object assertions provided usingRecursiveComparison()
then(actual).usingRecursiveComparison().ignoringAllOverriddenEquals().isEqualTo(expected);
}
use of org.assertj.core.internal.objects.data.PersonDto in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_for_iterables_Test method should_be_directly_usable_with_iterables.
// verify we don't need to cast actual to an Object as before when only Object assertions provided usingRecursiveComparison()
@Test
void should_be_directly_usable_with_iterables() {
// GIVEN
Set<PersonDto> expected = newHashSet(new PersonDto("Sheldon"), new PersonDto("Leonard"));
// WHEN/THEN
then(actual).usingRecursiveComparison().isEqualTo(expected);
}
use of org.assertj.core.internal.objects.data.PersonDto in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_for_object_arrays_Test method should_be_directly_usable_with_iterables.
// verify we don't need to cast actual to an Object as before when only Object assertions provided usingRecursiveComparison()
@Test
void should_be_directly_usable_with_iterables() {
// GIVEN
PersonDto[] expected = { new PersonDto("Sheldon"), new PersonDto("Leonard") };
// WHEN/THEN
then(actual).usingRecursiveComparison().isEqualTo(expected);
}
use of org.assertj.core.internal.objects.data.PersonDto in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_isEqualTo_strictTypeCheck_Test method should_pass_by_default_when_objects_data_are_equals_whatever_their_types_are.
@Test
void should_pass_by_default_when_objects_data_are_equals_whatever_their_types_are() {
// GIVEN
Person actual = new Person("John");
actual.home.address.number = 1;
actual.dateOfBirth = new Date(123);
actual.neighbour = new Person("Jack");
actual.neighbour.home.address.number = 123;
actual.neighbour.neighbour = new Person("James");
actual.neighbour.neighbour.home.address.number = 124;
PersonDto expected = new PersonDto("John");
expected.home.address.number = 1;
expected.dateOfBirth = new Date(123);
expected.neighbour = new PersonDto("Jack");
expected.neighbour.home.address.number = 123;
expected.neighbour.neighbour = new PersonDto("James");
expected.neighbour.neighbour.home.address.number = 124;
// THEN
assertThat(actual).usingRecursiveComparison().isEqualTo(expected);
}
use of org.assertj.core.internal.objects.data.PersonDto in project assertj-core by joel-costigliola.
the class RecursiveComparisonAssert_for_optionals_Test method should_be_directly_usable_with_maps.
// verify we don't need to cast actual to an Object as before when only Object assertions provided usingRecursiveComparison()
@Test
void should_be_directly_usable_with_maps() {
// GIVEN
Optional<Person> person = Optional.of(new Person("Sheldon"));
Optional<PersonDto> personDto = Optional.of(new PersonDto("Sheldon"));
// WHEN/THEN
then(person).usingRecursiveComparison().isEqualTo(personDto);
}
Aggregations