|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<T>
org.hamcrest.beans.HasProperty<T>
public class HasProperty<T>
A Matcher that checks that an object has a JavaBean property with the specified name. If an error occurs during introspection of the object then this is treated as a mismatch.
| Constructor Summary | |
|---|---|
HasProperty(java.lang.String propertyName)
|
|
| Method Summary | ||
|---|---|---|
void |
describeMismatchSafely(T item,
Description mismatchDescription)
Subclasses should override this. |
|
void |
describeTo(Description description)
Generates a description of the object. |
|
static
|
hasProperty(java.lang.String propertyName)
Creates a matcher that matches when the examined object has a JavaBean property with the specified name. |
|
boolean |
matchesSafely(T obj)
Subclasses should implement this. |
|
| Methods inherited from class org.hamcrest.TypeSafeMatcher |
|---|
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 |
|---|
public HasProperty(java.lang.String propertyName)
| Method Detail |
|---|
public boolean matchesSafely(T obj)
TypeSafeMatcher
matchesSafely in class TypeSafeMatcher<T>
public void describeMismatchSafely(T item,
Description mismatchDescription)
TypeSafeMatcher
describeMismatchSafely in class TypeSafeMatcher<T>public void describeTo(Description description)
SelfDescribing
description - The description to be built or appended to.public static <T> Matcher<T> hasProperty(java.lang.String propertyName)
assertThat(myBean, hasProperty("foo"))
propertyName - the name of the JavaBean property that examined beans should possess
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||