Class EqualFieldsMatcher<T>

java.lang.Object
org.hamcrest.BaseMatcher<T>
org.axonframework.test.matchers.EqualFieldsMatcher<T>
Type Parameters:
T - The type of object
All Implemented Interfaces:
org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing

public class EqualFieldsMatcher<T> extends org.hamcrest.BaseMatcher<T>
Matcher that will match an Object if all the fields on that Object contain values equal to the same field in the expected instance.
Since:
1.1
Author:
Allard Buijze
  • Constructor Details

    • EqualFieldsMatcher

      public EqualFieldsMatcher(T expected)
      Initializes an EqualFieldsMatcher that will match an object with equal properties as the given expected object.
      Parameters:
      expected - The expected object
    • EqualFieldsMatcher

      public EqualFieldsMatcher(T expected, FieldFilter filter)
      Initializes an EqualFieldsMatcher that will match an object with equal properties as the given expected object.
      Parameters:
      expected - The expected object
      filter - The filter describing the fields to include in the comparison
  • Method Details

    • matches

      public boolean matches(Object actual)
    • getFailedField

      public Field getFailedField()
      Returns the field that failed comparison, if any. This value is only populated after matches(Object) is called and a mismatch has been detected.
      Returns:
      the field that failed comparison, if any
    • getFailedFieldExpectedValue

      public Object getFailedFieldExpectedValue()
      Returns the expected value of a failed field comparison, if any. This value is only populated after matches(Object) is called and a mismatch has been detected.
      Returns:
      the expected value of the field that failed comparison, if any
    • getFailedFieldActualValue

      public Object getFailedFieldActualValue()
      Returns the actual value of a failed field comparison, if any. This value is only populated after matches(Object) is called and a mismatch has been detected.
      Returns:
      the actual value of the field that failed comparison, if any
    • describeTo

      public void describeTo(org.hamcrest.Description description)