org.easymock

Class AbstractMatcher

public abstract class AbstractMatcher extends Object implements ArgumentsMatcher

A convenience implementation of ArgumentsMatcher. A subclass that does not redefine any method will behave like EQUALS_MATCHER.
Method Summary
protected booleanargumentMatches(Object expected, Object actual)
Compares two arguments; used by (Object[], Object[]).
protected StringargumentToString(Object argument)
Converts an argument to a String, used by (Object[]).
booleanmatches(Object[] expected, Object[] actual)
Matches two arrays of arguments.
StringtoString(Object[] arguments)
Returns a string representation of the matcher.

Method Detail

argumentMatches

protected boolean argumentMatches(Object expected, Object actual)
Compares two arguments; used by (Object[], Object[]). The arguments provided to this method are always not null.

Parameters: expected the expected argument. actual the actual argument.

Returns: true if the arguments match, false otherwise.

argumentToString

protected String argumentToString(Object argument)
Converts an argument to a String, used by (Object[]).

Parameters: argument the argument to convert to a String.

Returns: a String representation of the argument.

matches

public boolean matches(Object[] expected, Object[] actual)
Matches two arrays of arguments. 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.

Parameters: expected the expected arguments. actual the actual arguments.

Returns: true if the arguments match, false otherwise.

toString

public String toString(Object[] arguments)
Returns a string representation of the matcher. This convenience implementation calls argumentToStringfor every argument in the given array and returns the string representations of the arguments separated by commas.

Parameters: arguments the arguments to be used in the string representation.

Returns: a string representation of the matcher.

Copyright © 2001-2005 OFFIS. This documentation is provided under the terms of the MIT licence.