(t *testing.T)
| 308 | } |
| 309 | |
| 310 | func TestMock_WithTest(t *testing.T) { |
| 311 | t.Parallel() |
| 312 | |
| 313 | var ( |
| 314 | mockedService TestExampleImplementation |
| 315 | mockedTest MockTestingT |
| 316 | ) |
| 317 | |
| 318 | mockedService.Test(&mockedTest) |
| 319 | mockedService.On("TheExampleMethod", 1, 2, 3).Return(0, nil) |
| 320 | |
| 321 | // Test that on an expected call, the test was not failed |
| 322 | |
| 323 | mockedService.TheExampleMethod(1, 2, 3) |
| 324 | |
| 325 | // Assert that Errorf and FailNow were not called |
| 326 | assert.Equal(t, 0, mockedTest.errorfCount) |
| 327 | assert.Equal(t, 0, mockedTest.failNowCount) |
| 328 | |
| 329 | // Test that on unexpected call, the mocked test was called to fail the test |
| 330 | |
| 331 | assert.PanicsWithValue(t, mockTestingTFailNowCalled, func() { |
| 332 | mockedService.TheExampleMethod(1, 1, 1) |
| 333 | }) |
| 334 | |
| 335 | // Assert that Errorf and FailNow were called once |
| 336 | assert.Equal(t, 1, mockedTest.errorfCount) |
| 337 | assert.Equal(t, 1, mockedTest.failNowCount) |
| 338 | } |
| 339 | |
| 340 | func Test_Mock_On_WithPtrArgMatcher(t *testing.T) { |
| 341 | t.Parallel() |
nothing calls this directly
no test coverage detected