func (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, *Call) {
	m.mutex.Lock()
	defer m.mutex.Unlock()
	for i, call := range m.ExpectedCalls {
		if call.Method == method && call.Repeatability > -1 {
			_, diffCount := call.Arguments.Diff(arguments)
			if diffCount == 0 {
				return i, call
			}
		}
	}
	return -1, nil
}
/*
Recording and responding to activity
package mock
import (
	"fmt"
	"reflect"
	"regexp"
	"runtime"
	"strings"
	"sync"
	"time"
	"github.com/davecgh/go-spew/spew"
	"github.com/pmezard/go-difflib/difflib"
	"github.com/stretchr/objx"
	"github.com/stretchr/testify/assert"
)
func inin() {
	spew.Config.SortKeys = true
}
type TestingT interface {
	Logf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	FailNow()
}
type Call struct {
	Parent *Mock
	Method string
	Arguments Arguments
	ReturnArguments Arguments
	Repeatability int
	totalCalls int
	WaitFor <-chan time.Time
	RunFn func(Arguments)
}
func newCall(parent *Mock, methodName string, methodArguments ...interface{}) *Call {
	return &Call{
		Parent:          parent,
		Method:          methodName,
		Arguments:       methodArguments,
		ReturnArguments: make([]interface{}, 0),
		Repeatability:   0,
		WaitFor:         nil,
		RunFn:           nil,
	}
}
func (c *Call) lock() {
	c.Parent.mutex.Lock()
}
func (c *Call) unlock() {
	c.Parent.mutex.Unlock()
}
func (c *Call) Return(returnArguments ...interface{}) *Call {
	c.lock()
	defer c.unlock()
	c.ReturnArguments = returnArguments
	return c
}
func (c *Call) Once() *Call {
	return c.Times(1)
}
func (c *Call) Twice() *Call {
	return c.Times(2)
}
func (c *Call) Times(i int) *Call {
	c.lock()
	defer c.unlock()
	c.Repeatability = i
	return c
}
func (c *Call) WaitUntil(w <-chan time.Time) *Call {
	c.lock()
	defer c.unlock()
	c.WaitFor = w
	return c
}
func (c *Call) After(d time.Duration) *Call {
	return c.WaitUntil(time.After(d))
}
func (c *Call) Run(fn func(Arguments)) *Call {
	c.lock()
	defer c.unlock()
	c.RunFn = fn
	return c
}
func (c *Call) On(methodName string, arguments ...interface{}) *Call {
	return c.Parent.On(methodName, arguments...)
}
type Mock struct {
	ExpectedCalls []*Call
	Calls []Call
	testData objx.Map
	mutex sync.Mutex
}
func (m *Mock) TestData() objx.Map {
	if m.testData == nil {
		m.testData = make(objx.Map)
	}
	return m.testData
}
func (m *Mock) On(methodName string, arguments ...interface{}) *Call {
	for _, arg := range arguments {
		if v := reflect.ValueOf(arg); v.Kind() == reflect.Func {
			panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg))
		}
	}
	m.mutex.Lock()
	defer m.mutex.Unlock()
	c := newCall(m, methodName, arguments...)
	m.ExpectedCalls = append(m.ExpectedCalls, c)
	return c
}