Enum RecursiveAssertionConfiguration.MapAssertionPolicy

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      MAP_OBJECT_AND_ENTRIES
      Apply the Predicate to the map as well as (recursively) to its keys and values.
      MAP_OBJECT_ONLY
      Apply the Predicate to the map but not to its entries.
      MAP_VALUES_ONLY
      Apply the Predicate (recursively) to the map values but not to the map itself or its keys.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MapAssertionPolicy()  
    • Enum Constant Detail

      • MAP_OBJECT_ONLY

        public static final RecursiveAssertionConfiguration.MapAssertionPolicy MAP_OBJECT_ONLY
        Apply the Predicate to the map but not to its entries.

        Consider the following example:

         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)); 
        With this policy, myPredicate(field) is applied to the greetings field but not to the objects contained in the greetings map entries.
      • MAP_VALUES_ONLY

        public static final RecursiveAssertionConfiguration.MapAssertionPolicy MAP_VALUES_ONLY
        Apply the Predicate (recursively) to the map values but not to the map itself or its keys.

         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)); 
        With this policy, myPredicate(field) is applied to the greetings map values "Hi" and "Salut" but not to the greetings field itself or its keys.
      • MAP_OBJECT_AND_ENTRIES

        public static final RecursiveAssertionConfiguration.MapAssertionPolicy MAP_OBJECT_AND_ENTRIES
        Apply the Predicate to the map as well as (recursively) to its keys and values.

        Consider the following example:

         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)); 
        With this policy, myPredicate(field) is applied to the greetings field and also to the keys and values of the greetings map: "english", "Hi", "french" and "Salut".
    • Constructor Detail

      • MapAssertionPolicy

        private MapAssertionPolicy()
    • Method Detail

      • values

        public static RecursiveAssertionConfiguration.MapAssertionPolicy[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (RecursiveAssertionConfiguration.MapAssertionPolicy c : RecursiveAssertionConfiguration.MapAssertionPolicy.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static RecursiveAssertionConfiguration.MapAssertionPolicy valueOf​(java.lang.String name)
        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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null