Skip to content

Conversation

@TrueJacobG
Copy link
Contributor

people list is not used, doctors list needs to have type List, because of the type checking

@scordio scordio self-assigned this May 18, 2025
@scordio
Copy link
Member

scordio commented May 18, 2025

Thanks for pointing this out, @TrueJacobG!

Following the semantics in the example comments, the contains parameter should have been people:

// assertion succeeds as both lists contains equivalent items in order.
assertThat(doctors).usingRecursiveFieldByFieldElementComparator(configuration)
                   .contains(sheldon); // FIXME should be the people list

// assertion fails because leonard names are different.
leonard.setName("Leonard Ofstater");
assertThat(doctors).usingRecursiveFieldByFieldElementComparator(configuration)
                   .contains(leonard); // FIXME should be the people list

// assertion fails because howard is missing and leonard is not expected.
people = list(howard, sheldon, raj)
assertThat(doctors).usingRecursiveFieldByFieldElementComparator(configuration)
                   .contains(howard); // FIXME should be the people list

However, it's not as simple as that since type checking kicks in.

For reference, the usingRecursiveFieldByFieldElementComparator Javadoc is also incorrect.

In light of this, I'm closing this PR in favor of assertj/assertj#3837.

@scordio scordio closed this May 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants