Class FieldMessages

java.lang.Object
org.assertj.core.api.recursive.comparison.FieldHolder<String>
org.assertj.core.api.recursive.comparison.FieldMessages

public class FieldMessages extends FieldHolder<String>
An internal holder of the custom messages for fields described by their path without element index.
  • Constructor Details

    • FieldMessages

      public FieldMessages()
  • Method Details

    • registerMessage

      public void registerMessage(String fieldLocation, String message)
      Pairs the giving error message with the fieldLocation.
      Parameters:
      fieldLocation - the field location where to apply the giving error message
      message - the error message
    • hasMessageForField

      public boolean hasMessageForField(String fieldLocation)
      Checks, whether an any custom message is associated with the giving field location.
      Parameters:
      fieldLocation - the field location which association need to check
      Returns:
      is field location contain a custom message
    • getMessageForField

      public String getMessageForField(String fieldLocation)
      Retrieves a custom message, which is associated with the giving field location. If this location does not associate with any custom message - this method returns null.
      Parameters:
      fieldLocation - the field location that has to be associated with a message
      Returns:
      a custom message or null
    • messageByFields

      public Stream<Map.Entry<String,String>> messageByFields()
      Returns a sequence of associated field-message pairs.
      Returns:
      sequence of field-message pairs