程序包 org.hamcrest

类 CustomMatcher<T>

  • 类型参数:
    T - The type of object being matched.
    所有已实现的接口:
    Matcher<T>, SelfDescribing

    public abstract class CustomMatcher<T>
    extends BaseMatcher<T>
    Utility class for writing one off matchers. For example:
     Matcher<String> aNonEmptyString = new CustomMatcher<String>("a non empty string") {
       public boolean matches(Object object) {
         return ((object instanceof String) && !((String) object).isEmpty();
       }
     };
     

    This class is designed for scenarios where an anonymous inner class matcher makes sense. It should not be used by API designers implementing matchers.

    另请参阅:
    for a type safe variant of this class that you probably want to use.
    • 方法详细资料

      • 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.