T
- The type of the object to be matchedU
- The type of the feature to be matchedMatcher<T>
, SelfDescribing
HasToString
, IsArrayWithSize
, IsCollectionWithSize
, IsIterableWithSize
public abstract class FeatureMatcher<T,U> extends TypeSafeDiagnosingMatcher<T>
featureValueOf()
in a subclass to pull out the feature to be matched against.Constructor | Description |
---|---|
FeatureMatcher(Matcher<? super U> subMatcher,
java.lang.String featureDescription,
java.lang.String featureName) |
Constructor
|
Modifier and Type | Method | Description |
---|---|---|
void |
describeTo(Description description) |
Generates a description of the object.
|
protected abstract U |
featureValueOf(T actual) |
Implement this to extract the interesting feature.
|
protected boolean |
matchesSafely(T actual,
Description mismatch) |
Subclasses should implement this.
|
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
describeMismatch, matches
public FeatureMatcher(Matcher<? super U> subMatcher, java.lang.String featureDescription, java.lang.String featureName)
subMatcher
- The matcher to apply to the featurefeatureDescription
- Descriptive text to use in describeTofeatureName
- Identifying text for mismatch messageprotected abstract U featureValueOf(T actual)
actual
- the target objectprotected boolean matchesSafely(T actual, Description mismatch)
TypeSafeDiagnosingMatcher
matchesSafely
in class TypeSafeDiagnosingMatcher<T>
public final void describeTo(Description description)
SelfDescribing
description
- The description to be built or appended to.