类 CombinableMatcher<T>
- java.lang.Object
- org.hamcrest.BaseMatcher<T>
- org.hamcrest.TypeSafeDiagnosingMatcher<T>
- org.hamcrest.core.CombinableMatcher<T>
- 所有已实现的接口:
Matcher<T>,SelfDescribing
public class CombinableMatcher<T> extends TypeSafeDiagnosingMatcher<T>
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classCombinableMatcher.CombinableBothMatcher<X>static classCombinableMatcher.CombinableEitherMatcher<X>
构造器概要
构造器 构造器 说明 CombinableMatcher(Matcher<? super T> matcher)
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 CombinableMatcher<T>and(Matcher<? super T> other)static <LHS> CombinableMatcher.CombinableBothMatcher<LHS>both(Matcher<? super LHS> matcher)Creates a matcher that matches when both of the specified matchers match the examined object.voiddescribeTo(Description description)Generates a description of the object.static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS>either(Matcher<? super LHS> matcher)Creates a matcher that matches when either of the specified matchers match the examined object.protected booleanmatchesSafely(T item, Description mismatch)Subclasses should implement this.CombinableMatcher<T>or(Matcher<? super T> other)从类继承的方法 org.hamcrest.TypeSafeDiagnosingMatcher
describeMismatch, matches
从类继承的方法 org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
构造器详细资料
CombinableMatcher
public CombinableMatcher(Matcher<? super T> matcher)
方法详细资料
matchesSafely
protected boolean matchesSafely(T item, Description mismatch)
从类复制的说明:TypeSafeDiagnosingMatcherSubclasses should implement this. The item will already have been checked for the specific type and will never be null.- 指定者:
matchesSafely在类中TypeSafeDiagnosingMatcher<T>
describeTo
public void describeTo(Description description)
从接口复制的说明:SelfDescribingGenerates 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.
and
public CombinableMatcher<T> and(Matcher<? super T> other)
or
public CombinableMatcher<T> or(Matcher<? super T> other)
both
public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
Creates a matcher that matches when both of the specified matchers match the examined object. For example:assertThat("fab", both(containsString("a")).and(containsString("b")))
either
public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
Creates a matcher that matches when either of the specified matchers match the examined object. For example:assertThat("fan", either(containsString("a")).and(containsString("b")))