public abstract class QuickDiagnosingMatcherBase<T> extends org.hamcrest.BaseMatcher<T> implements QuickDiagnosingMatcher<T>
Matcher that is able to match and diagnose in one step, but, unlike
DiagnosingMatcher, also provides an efficient implementation for the
simple match.| Constructor and Description |
|---|
QuickDiagnosingMatcherBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
describeMismatch(Object item,
org.hamcrest.Description description) |
boolean |
matches(Object o) |
abstract boolean |
matches(Object item,
org.hamcrest.Description mismatch)
Evaluates the matcher for argument
item. |
protected static boolean |
quickMatch(org.hamcrest.Matcher<?> matcher,
Object item,
org.hamcrest.Description mismatch)
Uses the
matcher to validate item. |
protected static boolean |
quickMatch(org.hamcrest.Matcher<?> matcher,
Object item,
org.hamcrest.Description mismatch,
String message)
Similar to
quickMatch(org.hamcrest.Matcher, java.lang.Object, org.hamcrest.Description),
but allows to override the mismatch message. |
_dont_implement_Matcher___instead_extend_BaseMatcher_, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic void describeMismatch(Object item, org.hamcrest.Description description)
public abstract boolean matches(Object item, org.hamcrest.Description mismatch)
item.
A mismatch description is appended to mismatch
if and only if the match fails.matches in interface QuickDiagnosingMatcher<T>item - The object against which the matcher is evaluated.mismatch - The description to be built or appended to.true if item matches, otherwise false.protected static boolean quickMatch(org.hamcrest.Matcher<?> matcher,
Object item,
org.hamcrest.Description mismatch)
matcher to validate item.
If validation fails, an error message is appended to mismatch.
The code is equivalent to
if (matcher.matches(item)) {
return true;
} else {
matcher.describeMismatch(item, mismatch);
return false;
}
but uses optimizations for diagnosing matchers.matcher - item - mismatch - true iif item was matchedDiagnosingMatcher,
QuickDiagnosingMatcherprotected static boolean quickMatch(org.hamcrest.Matcher<?> matcher,
Object item,
org.hamcrest.Description mismatch,
String message)
quickMatch(org.hamcrest.Matcher, java.lang.Object, org.hamcrest.Description),
but allows to override the mismatch message.
If matching fails, message will be appended to mismatch.
Any occurrence of "$1" in (@code message} will be replaced with
the actual mismatch description of matcher.matcher - item - mismatch - message - true iif item was matchedCopyright © 2013. All Rights Reserved.