(t *testing.T)
| 187 | } |
| 188 | |
| 189 | func Test_Mock_Chained_On(t *testing.T) { |
| 190 | t.Parallel() |
| 191 | |
| 192 | // make a test impl object |
| 193 | var mockedService = new(TestExampleImplementation) |
| 194 | |
| 195 | // determine our current line number so we can assert the expected calls callerInfo properly |
| 196 | _, filename, line, _ := runtime.Caller(0) |
| 197 | mockedService. |
| 198 | On("TheExampleMethod", 1, 2, 3). |
| 199 | Return(0). |
| 200 | On("TheExampleMethod3", AnythingOfType("*mock.ExampleType")). |
| 201 | Return(nil) |
| 202 | |
| 203 | expectedCalls := []*Call{ |
| 204 | { |
| 205 | Parent: &mockedService.Mock, |
| 206 | Method: "TheExampleMethod", |
| 207 | Arguments: []interface{}{1, 2, 3}, |
| 208 | ReturnArguments: []interface{}{0}, |
| 209 | callerInfo: []string{fmt.Sprintf("%s:%d", filename, line+2)}, |
| 210 | }, |
| 211 | { |
| 212 | Parent: &mockedService.Mock, |
| 213 | Method: "TheExampleMethod3", |
| 214 | Arguments: []interface{}{AnythingOfType("*mock.ExampleType")}, |
| 215 | ReturnArguments: []interface{}{nil}, |
| 216 | callerInfo: []string{fmt.Sprintf("%s:%d", filename, line+4)}, |
| 217 | }, |
| 218 | } |
| 219 | assert.Equal(t, expectedCalls, mockedService.ExpectedCalls) |
| 220 | } |
| 221 | |
| 222 | func Test_Mock_On_WithArgs(t *testing.T) { |
| 223 | t.Parallel() |
nothing calls this directly
no test coverage detected