public class CombinableMatcher<T> extends TypeSafeDiagnosingMatcher<T>
Modifier and Type | Class and Description |
---|---|
static class |
CombinableMatcher.CombinableBothMatcher<X> |
static class |
CombinableMatcher.CombinableEitherMatcher<X> |
Constructor and Description |
---|
CombinableMatcher(Matcher<? super T> matcher) |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
describeTo(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 boolean |
matchesSafely(T item,
Description mismatch)
Subclasses should implement this.
|
CombinableMatcher<T> |
or(Matcher<? super T> other) |
describeMismatch, matches
_dont_implement_Matcher___instead_extend_BaseMatcher_, isNotNull, toString
protected boolean matchesSafely(T item, Description mismatch)
TypeSafeDiagnosingMatcher
matchesSafely
in class TypeSafeDiagnosingMatcher<T>
public void describeTo(Description description)
SelfDescribing
description
- The description to be built or appended to.public CombinableMatcher<T> and(Matcher<? super T> other)
public CombinableMatcher<T> or(Matcher<? super T> other)
public static <LHS> CombinableMatcher.CombinableBothMatcher<LHS> both(Matcher<? super LHS> matcher)
assertThat("fab", both(containsString("a")).and(containsString("b")))
public static <LHS> CombinableMatcher.CombinableEitherMatcher<LHS> either(Matcher<? super LHS> matcher)
assertThat("fan", either(containsString("a")).or(containsString("b")))