Function below describes how to mock using testify. args.Bool(0)
, args.Error(1)
are mocked positional return values.
func (m *MyMockedObject) DoSomething(number int) (bool, error) {
args := m.Called(number)
return args.Bool(0), args.Error(1)
}
Is it possible to return anything other than args.Int()
, args.Bool()
, args.String()
? What if I need to return int64
, or a custom struct
. Is there a method or am I missing something?
For example:
func (m *someMock) doStuff(p *sql.DB, id int) (res int64, err error)