T
- The type of the object to be matchedU
- The type of the feature to be matchedpublic abstract class FeatureMatcher<T,U> extends TypeSafeDiagnosingMatcher<T>
featureValueOf()
in a subclass to pull out the feature to be matched against.Constructor and Description |
---|
FeatureMatcher(Matcher<? super U> subMatcher,
java.lang.String featureDescription,
java.lang.String featureName)
Constructor
|
Modifier and Type | Method and 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.
|
describeMismatch, matches
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
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.