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