org.easymock
Class AbstractMatcher
java.lang.Object
org.easymock.AbstractMatcher
- ArgumentsMatcher
public abstract class AbstractMatcher
extends java.lang.Object
implements ArgumentsMatcher
A convenience implementation of ArgumentsMatcher
. A subclass that
does not redefine any method will behave like
MockControl.EQUALS_MATCHER
.
protected boolean | argumentMatches(Object expected, Object actual) - Checks whether an expected argument matches an actual argument; the method
is used by
AbstractMatcher.matches(Object[], Object[]) .
|
protected String | argumentToString(Object argument) - Converts an argument to a String, used by
AbstractMatcher.toString(Object[]) .
|
boolean | matches(Object[] expected, Object[] actual) - Checks whether an expected argument array matches an actual argument array.
|
String | toString(Object[] arguments) - Returns a string representation of the matcher.
|
argumentMatches
protected boolean argumentMatches(Object expected,
Object actual)
Checks whether an expected argument matches an actual argument; the method
is used by
AbstractMatcher.matches(Object[], Object[])
. The arguments
provided to this method are always not null
.
expected
- the expected argument.actual
- the actual argument.
- true if the arguments match, false otherwise.
argumentToString
protected String argumentToString(Object argument)
Converts an argument to a String, used by
AbstractMatcher.toString(Object[])
.
argument
- the argument to convert to a String.
- a
String
representation of the argument.
matches
public boolean matches(Object[] expected,
Object[] actual)
Checks whether an expected argument array matches an actual argument array.
This convenience implementation uses
argumentMatches(Object, Object)
to check whether arguments
pairs match. If all the arguments match, true is returned, otherwise
false. In two cases, argumentMatches(Object, Object)
is
not called: If both argument arrays are null, they match; if one and only
one is null, they do not match.
expected
- the expected arguments.actual
- the actual arguments.
- true if the arguments match, false otherwise.
toString
public String toString(Object[] arguments)
Returns a string representation of the matcher. This convenience
implementation calls AbstractMatcher.argumentToString(Object)
for every argument in the given array and returns the string representations
of the arguments separated by commas.
arguments
- the arguments to be used in the string representation.
- a string representation of the matcher.