| 645 | } |
| 646 | |
| 647 | func Test_Mock_UnsetByOnMethodSpec(t *testing.T) { |
| 648 | t.Parallel() |
| 649 | |
| 650 | // make a test impl object |
| 651 | var mockedService = new(TestExampleImplementation) |
| 652 | |
| 653 | mock1 := mockedService. |
| 654 | On("TheExampleMethod", 1, 2, 3). |
| 655 | Return(0, nil) |
| 656 | |
| 657 | assert.Equal(t, 1, len(mockedService.ExpectedCalls)) |
| 658 | mock1.On("TheExampleMethod", 1, 2, 3). |
| 659 | Return(0, nil).Unset() |
| 660 | |
| 661 | assert.Equal(t, 0, len(mockedService.ExpectedCalls)) |
| 662 | |
| 663 | assert.Panics(t, func() { |
| 664 | mock1.Unset() |
| 665 | }) |
| 666 | |
| 667 | assert.Equal(t, 0, len(mockedService.ExpectedCalls)) |
| 668 | } |
| 669 | |
| 670 | func Test_Mock_UnsetByOnMethodSpecAmongOthers(t *testing.T) { |
| 671 | t.Parallel() |