147d431f63a66505a645f282416659a9758a91f1cBrett Chabot/*
247d431f63a66505a645f282416659a9758a91f1cBrett Chabot * Copyright 2001-2009 OFFIS, Tammo Freese
347d431f63a66505a645f282416659a9758a91f1cBrett Chabot *
447d431f63a66505a645f282416659a9758a91f1cBrett Chabot * Licensed under the Apache License, Version 2.0 (the "License");
547d431f63a66505a645f282416659a9758a91f1cBrett Chabot * you may not use this file except in compliance with the License.
647d431f63a66505a645f282416659a9758a91f1cBrett Chabot * You may obtain a copy of the License at
747d431f63a66505a645f282416659a9758a91f1cBrett Chabot *
847d431f63a66505a645f282416659a9758a91f1cBrett Chabot *     http://www.apache.org/licenses/LICENSE-2.0
947d431f63a66505a645f282416659a9758a91f1cBrett Chabot *
1047d431f63a66505a645f282416659a9758a91f1cBrett Chabot * Unless required by applicable law or agreed to in writing, software
1147d431f63a66505a645f282416659a9758a91f1cBrett Chabot * distributed under the License is distributed on an "AS IS" BASIS,
1247d431f63a66505a645f282416659a9758a91f1cBrett Chabot * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1347d431f63a66505a645f282416659a9758a91f1cBrett Chabot * See the License for the specific language governing permissions and
1447d431f63a66505a645f282416659a9758a91f1cBrett Chabot * limitations under the License.
1547d431f63a66505a645f282416659a9758a91f1cBrett Chabot */
1647d431f63a66505a645f282416659a9758a91f1cBrett Chabotpackage org.easymock;
1747d431f63a66505a645f282416659a9758a91f1cBrett Chabot
1847d431f63a66505a645f282416659a9758a91f1cBrett Chabot/**
1947d431f63a66505a645f282416659a9758a91f1cBrett Chabot * A comparison function that is used to match arguments.
2047d431f63a66505a645f282416659a9758a91f1cBrett Chabot *
2147d431f63a66505a645f282416659a9758a91f1cBrett Chabot * @see MockControl#setDefaultMatcher
2247d431f63a66505a645f282416659a9758a91f1cBrett Chabot * @see MockControl#setMatcher
2347d431f63a66505a645f282416659a9758a91f1cBrett Chabot * @see MockControl#EQUALS_MATCHER
2447d431f63a66505a645f282416659a9758a91f1cBrett Chabot * @see MockControl#ARRAY_MATCHER
2547d431f63a66505a645f282416659a9758a91f1cBrett Chabot * @see MockControl#ALWAYS_MATCHER
2647d431f63a66505a645f282416659a9758a91f1cBrett Chabot *
2747d431f63a66505a645f282416659a9758a91f1cBrett Chabot * @deprecated Since EasyMock 2.0, <code>ArgumentsMatcher</code>s are only supported
2847d431f63a66505a645f282416659a9758a91f1cBrett Chabot * for the legacy <code>MockControl</code>. For mock objects generated by the methods
2947d431f63a66505a645f282416659a9758a91f1cBrett Chabot * on <code>EasyMock</code>, there are per-argument matchers available. For more
3047d431f63a66505a645f282416659a9758a91f1cBrett Chabot * information, see the EasyMock documentation.
3147d431f63a66505a645f282416659a9758a91f1cBrett Chabot */
3247d431f63a66505a645f282416659a9758a91f1cBrett Chabotpublic interface ArgumentsMatcher {
3347d431f63a66505a645f282416659a9758a91f1cBrett Chabot
3447d431f63a66505a645f282416659a9758a91f1cBrett Chabot    /**
3547d431f63a66505a645f282416659a9758a91f1cBrett Chabot     * Matches two arrays of arguments.
3647d431f63a66505a645f282416659a9758a91f1cBrett Chabot     *
3747d431f63a66505a645f282416659a9758a91f1cBrett Chabot     * @param expected
3847d431f63a66505a645f282416659a9758a91f1cBrett Chabot     *            the expected arguments.
3947d431f63a66505a645f282416659a9758a91f1cBrett Chabot     * @param actual
4047d431f63a66505a645f282416659a9758a91f1cBrett Chabot     *            the actual arguments.
4147d431f63a66505a645f282416659a9758a91f1cBrett Chabot     * @return true if the arguments match, false otherwise.
4247d431f63a66505a645f282416659a9758a91f1cBrett Chabot     */
4347d431f63a66505a645f282416659a9758a91f1cBrett Chabot    boolean matches(Object[] expected, Object[] actual);
4447d431f63a66505a645f282416659a9758a91f1cBrett Chabot
4547d431f63a66505a645f282416659a9758a91f1cBrett Chabot    /**
4647d431f63a66505a645f282416659a9758a91f1cBrett Chabot     * Returns a string representation of the arguments.
4747d431f63a66505a645f282416659a9758a91f1cBrett Chabot     *
4847d431f63a66505a645f282416659a9758a91f1cBrett Chabot     * @param arguments
4947d431f63a66505a645f282416659a9758a91f1cBrett Chabot     *            the arguments to be used in the string representation.
5047d431f63a66505a645f282416659a9758a91f1cBrett Chabot     * @return a string representation of the arguments.
5147d431f63a66505a645f282416659a9758a91f1cBrett Chabot     */
5247d431f63a66505a645f282416659a9758a91f1cBrett Chabot    String toString(Object[] arguments);
5347d431f63a66505a645f282416659a9758a91f1cBrett Chabot}
54