You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -450,14 +450,14 @@ Here's a simple example to give an idea of what it can do:
450
450
assertThat(sherlock).isEqualTo(sherlock2);
451
451
----
452
452
453
-
The comparison is *not symmetrical* since it is *limited to actual's fields*, the algorithm gather actual's fields and then compare them to the corresponding expected's fields. It is then possible for the expected object to have more fields than actual which cna be handy when comparing a base type to a subtype with additional fields.
453
+
The comparison is *not symmetrical* since it is *limited to actual's fields*, the algorithm gather actual's fields and then compare them to the corresponding expected's fields. It is then possible for the expected object to have more fields than actual which cna be handy when comparing a base type to a subtype with additional fields.
454
454
455
455
[[assertj-core-recursive-comparison-strict]]
456
456
==== Strict or lenient comparison
457
457
458
458
By default the objects to compare can be of different types but must have the same properties/fields. For example if object under test has a `work` field of type `Address`, the expected object to compare the object under test to must also have one but it can of a different type like `AddressDto`.
459
459
460
-
It is possible to enforce strict type checking by calling `withStrictTypeChecking()` and make the comparison fail whenever the compared objects or their fields are not compatible. Compatible means that the expected object/field types are the same or a subtype of actual/field types, for example if actual is an `Animal` and expected a `Dog`, they will be compared fiels by field in strict type checking mode.
460
+
It is possible to enforce strict type checking by calling `withStrictTypeChecking()` and make the comparison fail whenever the compared objects or their fields are not compatible. Compatible means that the expected object/field types are the same or a subtype of actual/field types, for example if actual is an `Animal` and expected a `Dog`, they will be compared fiels by field in strict type checking mode.
By default the recursive comparison uses overridden `equals` methods to compare fields, it is possible to change that behavior and force a recursive comparison by calling:
567
+
By default the recursive comparison uses overridden `equals` methods to compare fields, it is possible to change that behavior and force a recursive comparison by calling:
568
568
569
569
* `ignoringOverriddenEqualsForTypes(Class...)` Any fields of these classes are compared recursively
570
570
* `ignoringOverriddenEqualsForFields(String...)` Any given fields are compared recursively
0 commit comments