Reputation: 7543
JUnit tests...
It needs to compare 2 single elements excepting some fields. I can use assertj for this:
Assertions.assertThat(actual).isEqualToIgnoringGivenFields(except, "id", "innerCollection");
and it works good. But it's not enough. I need to compare inner collections also. I know that only ids are different in inner collection. Is it possible to compare ones like
Assertions.assertThat(to.getInnerCollection()).isEqualToIgnoringGivenFields(from.getInnerCollection()
, {except fields in collection elements});
Upvotes: 3
Views: 5936