KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > easymock > internal > ExpectedMethodCall


1 /*
2  * Copyright (c) 2001-2005 OFFIS. This program is made available under the terms of
3  * the MIT License.
4  */

5 package org.easymock.internal;
6
7 import java.lang.reflect.Method JavaDoc;
8
9 import org.easymock.ArgumentsMatcher;
10
11 public class ExpectedMethodCall {
12
13     private final MethodCall methodCall;
14
15     private final ArgumentsMatcher matcher;
16
17     public ExpectedMethodCall(Method JavaDoc method, Object JavaDoc[] arguments,
18             ArgumentsMatcher matcher) {
19         this.methodCall = new MethodCall(method, arguments);
20         this.matcher = matcher;
21     }
22
23     public boolean equals(Object JavaDoc o) {
24         if (o == null || !this.getClass().equals(o.getClass()))
25             return false;
26
27         ExpectedMethodCall other = (ExpectedMethodCall) o;
28         return this.methodCall.equals(other.methodCall)
29                 && this.matcher.equals(other.matcher);
30     }
31
32     public int hashCode() {
33         return methodCall.hashCode();
34     }
35
36     public boolean matches(MethodCall actualCall) {
37         return this.methodCall.matches(actualCall, matcher);
38     }
39
40     public boolean matches(Method JavaDoc method, Object JavaDoc[] arguments) {
41         return matches(new MethodCall(method, arguments));
42     }
43
44     public String JavaDoc toString() {
45         return methodCall.toString(matcher);
46     }
47 }
48
Popular Tags