• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2001-2006 OFFIS, Tammo Freese
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.easymock;
17 
18 /**
19  * Decides whether an actual argument is accepted.
20  */
21 public interface IArgumentMatcher {
22 
23     /**
24      * Returns whether this matcher accepts the given argument.
25      * <p>
26      * Like Object.equals(), it should be aware that the argument passed might
27      * be null and of any type. So you will usually start the method with an
28      * instanceof and/or null check.
29      * <p>
30      * The method should <b>never</b> assert if the argument doesn't match. It
31      * should only return false. EasyMock will take care of asserting if the
32      * call is really unexpected.
33      *
34      * @param argument the argument
35      * @return whether this matcher accepts the given argument.
36      */
matches(Object argument)37     boolean matches(Object argument);
38 
39     /**
40      * Appends a string representation of this matcher to the given buffer. In case
41      * of failure, the printed message will show this string to allow to know which
42      * matcher was used for the failing call.
43      *
44      * @param buffer the buffer to which the string representation is appended.
45      */
appendTo(StringBuffer buffer)46     void appendTo(StringBuffer buffer);
47 }
48