m.EXPECT().SomeMethod(name string, number int).DoAndReturn(func() error {
//Various processing
return nil
})
This gives a panic: reflect: Call with too many input arguments
error
So do the following
m.EXPECT().SomeMethod(name string, number int).DoAndReturn(func(name string, number int) error {
//Various processing
return nil
})
In other words, the argument of the method (SomeMethod) you want to mock and the argument of the function of DoAndReturn must match.
Recommended Posts