What to use instead of AssertJ isEqualToIgnoringGivenFields?
Asked Answered
J

1

10

This method seems to be Deprecated. I would really appreciate it if you could tell me what AssertJ advises to use instead.

Jawbone answered 25/6, 2021 at 18:26 Comment(0)
P
27

As mentioned in the javadoc:

Use the recursive comparison by calling usingRecursiveComparison() and chain with ignoringFields(String...).

This method is deprecated because it only compares the first level of fields while the recursive comparison traverses all fields recursively (only stopping at java types).

assertThat(oneObject)
    .usingRecursiveComparison()
    .ignoringFields("fieldToIgnore")
    .isEqualTo(anotherObject);
Polyphagia answered 25/6, 2021 at 19:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.