Enum RecursiveAssertionConfiguration.MapAssertionPolicy
java.lang.Object
java.lang.Enum<RecursiveAssertionConfiguration.MapAssertionPolicy>
org.assertj.core.api.recursive.assertion.RecursiveAssertionConfiguration.MapAssertionPolicy
- All Implemented Interfaces:
Serializable,Comparable<RecursiveAssertionConfiguration.MapAssertionPolicy>
- Enclosing class:
RecursiveAssertionConfiguration
public static enum RecursiveAssertionConfiguration.MapAssertionPolicy
extends Enum<RecursiveAssertionConfiguration.MapAssertionPolicy>
Possible policies to use regarding maps when recursively asserting over the fields of an object tree.
- Author:
- bzt
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionReturns the enum constant of this type with the specified name.values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
MAP_OBJECT_ONLY
Apply thePredicateto the map but not to its entries.Consider the following example:
With this policy,class Parent { Map<String, String> greetings = new HashMap<>(); } Parent parent = new Parent(); parent.greetings.put("english", "Hi"); parent.greetings.put("french", "Salut"); assertThat(parent).usingRecursiveAssertion() .allFieldsSatisfy(field -> myPredicate(field));myPredicate(field)is applied to thegreetingsfield but not to the objects contained in thegreetingsmap entries. -
MAP_VALUES_ONLY
Apply thePredicate(recursively) to the map values but not to the map itself or its keys.
With this policy,class Parent { Map<String, String> greetings = new HashMap<>(); } Parent parent = new Parent(); parent.greetings.put("english", "Hi"); parent.greetings.put("french", "Salut"); assertThat(parent).usingRecursiveAssertion() .allFieldsSatisfy(field -> myPredicate(field));myPredicate(field)is applied to thegreetingsmap values"Hi"and"Salut"but not to thegreetingsfield itself or its keys. -
MAP_OBJECT_AND_ENTRIES
Apply thePredicateto the map as well as (recursively) to its keys and values.Consider the following example:
With this policy,class Parent { Map<String, String> greetings = new HashMap<>(); } Parent parent = new Parent(); parent.greetings.put("english", "Hi"); parent.greetings.put("french", "Salut"); assertThat(parent).usingRecursiveAssertion() .allFieldsSatisfy(field -> myPredicate(field));myPredicate(field)is applied to thegreetingsfield and also to the keys and values of thegreetingsmap:"english", "Hi", "french"and"Salut".
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-