KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mockobjects > dynamic > CallSignature


1 package com.mockobjects.dynamic;
2
3 import junit.framework.Assert;
4
5 public class CallSignature extends Assert implements Callable
6 {
7     private String JavaDoc methodName;
8     private ConstraintMatcher constraints;
9     private Callable delegate;
10     
11     public CallSignature( String JavaDoc methodName, ConstraintMatcher constraints, Callable delegate ) {
12         this.methodName = methodName;
13         this.constraints = constraints;
14         this.delegate = delegate;
15     }
16
17     public Object JavaDoc call( Mock mock, String JavaDoc methodName, Object JavaDoc[] args )
18         throws Throwable JavaDoc
19     {
20         return delegate.call( mock, methodName, args );
21     }
22     
23     public void verify() {
24         delegate.verify();
25     }
26
27     public boolean matches(String JavaDoc methodName, Object JavaDoc[] args) {
28         return this.methodName.equals(methodName) && constraints.matches(args);
29     }
30     
31     public String JavaDoc getDescription() {
32         return DynamicUtil.methodToString(methodName, constraints.getConstraints());
33     }
34     
35     // Implemented to aid visualisation in an IDE debugger
36
public String JavaDoc toString() {
37         return Mock.className(this.getClass()) + "(" + this.getDescription() + ")";
38     }
39 }
40
Popular Tags