org.hamcrest.beans
Class SamePropertyValuesAs<T>

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeDiagnosingMatcher<T>
          extended by org.hamcrest.beans.SamePropertyValuesAs<T>
All Implemented Interfaces:
org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing

public class SamePropertyValuesAs<T>
extends org.hamcrest.TypeSafeDiagnosingMatcher<T>


Nested Class Summary
static class SamePropertyValuesAs.PropertyMatcher
           
 
Constructor Summary
SamePropertyValuesAs(T expectedBean)
           
 
Method Summary
 void describeTo(org.hamcrest.Description description)
           
 boolean matchesSafely(T bean, org.hamcrest.Description mismatch)
           
static
<T> org.hamcrest.Matcher<T>
samePropertyValuesAs(T expectedBean)
          Creates a matcher that matches when the examined object has values for all of its JavaBean properties that are equal to the corresponding values of the specified bean.
 
Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
 
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SamePropertyValuesAs

public SamePropertyValuesAs(T expectedBean)
Method Detail

matchesSafely

public boolean matchesSafely(T bean,
                             org.hamcrest.Description mismatch)
Specified by:
matchesSafely in class org.hamcrest.TypeSafeDiagnosingMatcher<T>

describeTo

public void describeTo(org.hamcrest.Description description)

samePropertyValuesAs

public static <T> org.hamcrest.Matcher<T> samePropertyValuesAs(T expectedBean)
Creates a matcher that matches when the examined object has values for all of its JavaBean properties that are equal to the corresponding values of the specified bean.

For example:

assertThat(myBean, samePropertyValuesAs(myExpectedBean))

Parameters:
expectedBean - the bean against which examined beans are compared