* Recording and responding to activity */
(method string, arguments ...interface{})
| 386 | // */ |
| 387 | |
| 388 | func (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, *Call) { |
| 389 | var expectedCall *Call |
| 390 | |
| 391 | for i, call := range m.ExpectedCalls { |
| 392 | if call.Method == method { |
| 393 | _, diffCount := call.Arguments.Diff(arguments) |
| 394 | if diffCount == 0 { |
| 395 | expectedCall = call |
| 396 | if call.Repeatability > -1 { |
| 397 | return i, call |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | return -1, expectedCall |
| 404 | } |
| 405 | |
| 406 | type matchCandidate struct { |
| 407 | call *Call |