What to Use Instead of Assertj isEqualToIgnoringGivenFields?
This Method Seems to Be Deprecated. I Would Really Appreciate It If You Could Tell Me What Assertj Advises to Use Instead. 0 1 Answer as Mentioned in the...
This method seems to be Deprecated. I would really appreciate it if you could tell me what AssertJ advises to use instead.
1 Answer
As mentioned in the javadoc:
Use the recursive comparison by calling
usingRecursiveComparison()and chain withignoringFields(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);