/**
  * Checks whether the given method was called - allows distinguishing between overloads by
  * specifying the parameter types.
  *
  * @param name method name
  * @param paramTypes method parameters
  * @return true if the method with the given parameters was called, false otherwise
  */
 public boolean wasMethodCalled(String name, Class<?>... paramTypes) {
   for (MethodInvocation invocation : invocations) {
     if (invocation.method.equals(name) && invocation.paramTypesMatch(paramTypes)) return true;
   }
   return false;
 }