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. As mentioned in the javadoc: Use the recursive comparison by calling usingRecursiveComparison() and chain with ignoringFields(String...).

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 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); 

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobXFpY2qDdHyOsJ%2BarF2pvG7B0p5koqajqbKisIyonWaZo6iys8DJZqCsnaGqrq3AzqKep6einruos8ivnKeemZq5pb8%3D

 Share!