public interface Matcher<T> extends SelfDescribing
Matcher implementations should NOT directly implement this interface.
Instead, extend the BaseMatcher
abstract class,
which will ensure that the Matcher API can grow to support
new features and remain compatible with all Matcher implementations.
For easy access to common Matcher implementations, use the static factory
methods in CoreMatchers
.
CoreMatchers
,
BaseMatcher
Modifier and Type | Method and Description |
---|---|
void |
_dont_implement_Matcher___instead_extend_BaseMatcher_()
This method simply acts a friendly reminder not to implement Matcher directly and
instead extend BaseMatcher.
|
boolean |
matches(Object item)
Evaluates the matcher for argument item.
|
describeTo
boolean matches(Object item)
This method matches against Object, instead of the generic type T. This is because the caller of the Matcher does not know at runtime what the type is (because of type erasure with Java generics). It is down to the implementations to check the correct type.
item
- the object against which the matcher is evaluated.true
if item matches, otherwise false
.BaseMatcher
void _dont_implement_Matcher___instead_extend_BaseMatcher_()
for reasons why.
,
BaseMatcher
Copyright © 2018. All rights reserved.