/** * 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. * <p/> * For example: * <pre>assertThat(myBean, samePropertyValuesAs(myExpectedBean))</pre> * * @param expectedBean * the bean against which examined beans are compared */ @Factory public static <T> Matcher<T> samePropertyValuesAs(T expectedBean) { return new 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. If any properties are marked as ignored, they will be dropped from * both the expected and actual bean. Note that the ignored properties use JavaBean * display names, for example <pre>age</pre> rather than method names such as <pre>getAge</pre>. * For example: * <pre>assertThat(myBean, samePropertyValuesAs(myExpectedBean))</pre> * <pre>assertThat(myBean, samePropertyValuesAs(myExpectedBean), "age", "height")</pre> * * @param expectedBean * the bean against which examined beans are compared * @param ignoredProperties * do not check any of these named properties. */ public static <B> Matcher<B> samePropertyValuesAs(B expectedBean, String... ignoredProperties) { return new SamePropertyValuesAs<>(expectedBean, asList(ignoredProperties)); }
/** * 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: * <pre>assertThat(myBean, samePropertyValuesAs(myExpectedBean))</pre> * * @param expectedBean * the bean against which examined beans are compared */ public static <T> Matcher<T> samePropertyValuesAs(T expectedBean) { return new 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. If any properties are marked as ignored, they will be dropped from * both the expected and actual bean. Note that the ignored properties use JavaBean * display names, for example <pre>age</pre> rather than method names such as <pre>getAge</pre>. * For example: * <pre>assertThat(myBean, samePropertyValuesAs(myExpectedBean))</pre> * <pre>assertThat(myBean, samePropertyValuesAs(myExpectedBean), "age", "height")</pre> * * @param expectedBean * the bean against which examined beans are compared * @param ignoredProperties * do not check any of these named properties. */ public static <B> Matcher<B> samePropertyValuesAs(B expectedBean, String... ignoredProperties) { return new SamePropertyValuesAs<>(expectedBean, asList(ignoredProperties)); }