(t *testing.T)
| 558 | } |
| 559 | |
| 560 | func Test_Mock_Unset(t *testing.T) { |
| 561 | t.Parallel() |
| 562 | |
| 563 | // make a test impl object |
| 564 | var mockedService = new(TestExampleImplementation) |
| 565 | |
| 566 | call := mockedService. |
| 567 | On("TheExampleMethodFuncType", "argA"). |
| 568 | Return("blah") |
| 569 | |
| 570 | found, foundCall := mockedService.findExpectedCall("TheExampleMethodFuncType", "argA") |
| 571 | require.NotEqual(t, -1, found) |
| 572 | require.Equal(t, foundCall, call) |
| 573 | |
| 574 | call.Unset() |
| 575 | |
| 576 | found, foundCall = mockedService.findExpectedCall("TheExampleMethodFuncType", "argA") |
| 577 | require.Equal(t, -1, found) |
| 578 | |
| 579 | var expectedCall *Call |
| 580 | require.Equal(t, expectedCall, foundCall) |
| 581 | |
| 582 | fn := func(string) error { return nil } |
| 583 | assert.Panics(t, func() { |
| 584 | mockedService.TheExampleMethodFuncType(fn) |
| 585 | }) |
| 586 | } |
| 587 | |
| 588 | // Since every time you call On it creates a new object |
| 589 | // the last time you call Unset it will only unset the last call |
nothing calls this directly
no test coverage detected
searching dependent graphs…