(t *testing.T)
| 338 | } |
| 339 | |
| 340 | func Test_Mock_On_WithPtrArgMatcher(t *testing.T) { |
| 341 | t.Parallel() |
| 342 | |
| 343 | var mockedService TestExampleImplementation |
| 344 | |
| 345 | mockedService.On("TheExampleMethod3", |
| 346 | MatchedBy(func(a *ExampleType) bool { return a != nil && a.ran == true }), |
| 347 | ).Return(nil) |
| 348 | |
| 349 | mockedService.On("TheExampleMethod3", |
| 350 | MatchedBy(func(a *ExampleType) bool { return a != nil && a.ran == false }), |
| 351 | ).Return(errors.New("error")) |
| 352 | |
| 353 | mockedService.On("TheExampleMethod3", |
| 354 | MatchedBy(func(a *ExampleType) bool { return a == nil }), |
| 355 | ).Return(errors.New("error2")) |
| 356 | |
| 357 | assert.Equal(t, mockedService.TheExampleMethod3(&ExampleType{true}), nil) |
| 358 | assert.EqualError(t, mockedService.TheExampleMethod3(&ExampleType{false}), "error") |
| 359 | assert.EqualError(t, mockedService.TheExampleMethod3(nil), "error2") |
| 360 | } |
| 361 | |
| 362 | func Test_Mock_On_WithFuncArgMatcher(t *testing.T) { |
| 363 | t.Parallel() |
nothing calls this directly
no test coverage detected