On starts a description of an expectation of the specified method being called. Mock.On("MyMethod", arg1, arg2)
(methodName string, arguments ...interface{})
| 367 | // |
| 368 | // Mock.On("MyMethod", arg1, arg2) |
| 369 | func (m *Mock) On(methodName string, arguments ...interface{}) *Call { |
| 370 | for _, arg := range arguments { |
| 371 | if v := reflect.ValueOf(arg); v.Kind() == reflect.Func { |
| 372 | panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg)) |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | m.mutex.Lock() |
| 377 | defer m.mutex.Unlock() |
| 378 | |
| 379 | c := newCall(m, methodName, assert.CallerInfo(), arguments, make([]interface{}, 0)) |
| 380 | m.ExpectedCalls = append(m.ExpectedCalls, c) |
| 381 | return c |
| 382 | } |
| 383 | |
| 384 | // /* |
| 385 | // Recording and responding to activity |