程序包 org.hamcrest

类 FeatureMatcher<T,​U>

  • 类型参数:
    T - The type of the object to be matched
    U - The type of the feature to be matched
    所有已实现的接口:
    Matcher<T>, SelfDescribing

    public abstract class FeatureMatcher<T,​U>
    extends TypeSafeDiagnosingMatcher<T>
    Supporting class for matching a feature of an object. Implement featureValueOf() in a subclass to pull out the feature to be matched against.
    • 构造器详细资料

      • FeatureMatcher

        public FeatureMatcher​(Matcher<? super U> subMatcher,
                              String featureDescription,
                              String featureName)
        Constructor
        参数:
        subMatcher - The matcher to apply to the feature
        featureDescription - Descriptive text to use in describeTo
        featureName - Identifying text for mismatch message
    • 方法详细资料

      • featureValueOf

        protected abstract U featureValueOf​(T actual)
        Implement this to extract the interesting feature.
        参数:
        actual - the target object
        返回:
        the feature to be matched
      • describeTo

        public final void describeTo​(Description description)
        从接口复制的说明: SelfDescribing
        Generates a description of the object. The description may be part of a a description of a larger object of which this is just a component, so it should be worded appropriately.
        参数:
        description - The description to be built or appended to.