
org.cthul.matchers.diagnose.QuickDiagnosingMatcher Maven / Gradle / Ivy
Show all versions of cthul-matchers Show documentation
package org.cthul.matchers.diagnose;
import org.cthul.matchers.diagnose.result.MatchResult;
import org.hamcrest.*;
/**
* A {@link Matcher} that is able to match and diagnose in one step, but, unlike
* {@link DiagnosingMatcher}, also provides an efficient implementation for the
* simple match.
*
* The matcher is also able to provide a {@link MatchResult} that caches
* all relevant information about the match.
*
* Implementations of this interface should extend
* {@link QuickDiagnosingMatcherBase}.
* See this class for more implementation tips.
* @param
*/
public interface QuickDiagnosingMatcher extends Matcher {
/**
* Evaluates the matcher for argument {@code item}.
*
* A mismatch description is appended to {@code mismatch}
* if and only if the match fails.
*
* @param item The object against which the matcher is evaluated.
* @param mismatch The description to be built or appended to.
* @return {@code true} if {@code item} matches, otherwise {@code false}.
*/
boolean matches(Object item, Description mismatch);
/**
* Returns a {@link MatchResult} for {@code item}
* @param
* @param item
* @return match result
*/
MatchResult matchResult(I item);
}