org.axonframework.test.matchers
Class EqualFieldsMatcher<T>

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by 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 Summary
EqualFieldsMatcher(T expected)
          Initializes an EqualFieldsMatcher that will match an object with equal properties as the given expected object.
EqualFieldsMatcher(T expected, FieldFilter filter)
          Initializes an EqualFieldsMatcher that will match an object with equal properties as the given expected object.
 
Method Summary
 void describeTo(org.hamcrest.Description description)
           
 Field getFailedField()
          Returns the field that failed comparison, if any.
 Object getFailedFieldActualValue()
          Returns the actual value of a failed field comparison, if any.
 Object getFailedFieldExpectedValue()
          Returns the expected value of a failed field comparison, if any.
 boolean matches(Object item)
           
 
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

matches

public boolean matches(Object item)

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)


Copyright © 2010-2016. All Rights Reserved.