Class FieldMessages

java.lang.Object
org.assertj.core.api.recursive.comparison.FieldMessages

public class FieldMessages extends Object
An internal holder of the custom messages for fields described by their path without element index.
  • Field Details

  • 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
    • put

      public void put(String fieldLocation, String entity)
      Pairs the giving entity with the fieldLocation.
      Parameters:
      fieldLocation - the field location where to apply the giving entity
      entity - the entity to pair
    • get

      public String get(String fieldLocation)
      Retrieves a specific entity which is associated with the giving filedLocation from the field holder, if it presents. Otherwise, this method returns null.
      Parameters:
      fieldLocation - the field location which has to be associated with an entity
      Returns:
      entity or null
    • hasEntity

      public boolean hasEntity(String fieldLocation)
      Checks, whether an any entity associated with the giving field location.
      Parameters:
      fieldLocation - the field location which association need to check
      Returns:
      is entity associated with field location
    • isEmpty

      public boolean isEmpty()
      Returns:
      true is there are registered entities, false otherwise
    • entryByField

      public Stream<Map.Entry<String,String>> entryByField()
      Returns a sequence of all field-entry pairs which the current holder supplies.
      Returns:
      sequence of field-entry pairs
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object