Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectAll ¶
func ExpectAll(ctrl *gomock.Controller, mock interface{}, args []interface{}, callFunc func(call *gomock.Call))
ExpectAll expects all methods of target mock with gomock. Passing nil in args will use gomock.Any() for all arguments. If you want to use Do or DoAndReturn of gomock.Call, you can use it by passing a function to callFunc. Example: func(call *gomock.Call) { call.Return("return", 5050)}
Example ¶
t := new(testing.T) // *testing.T ctrl := gomock.NewController(t) defer ctrl.Finish() var mockDoer1 Doer1 = mock.NewMockDoer1(ctrl) gomockhelper.ExpectAll(ctrl, mockDoer1, []interface{}{}, nil) mockDoer1.Do1() mockDoer1.Do2() mockDoer1.Do3() var mockDoer2 Doer2 = mock.NewMockDoer2(ctrl) gomockhelper.ExpectAll(ctrl, mockDoer2, []interface{}{1234, "arg"}, func(call *gomock.Call) { call.Return("foo", 5050) }) fmt.Println(mockDoer2.DoWithReturns1(1234, "arg")) fmt.Println(mockDoer2.DoWithReturns2(1234, "arg"))
Output: foo 5050 foo 5050
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.