| 624 | } |
| 625 | |
| 626 | func Test_Mock_UnsetIfAlreadyUnsetFails(t *testing.T) { |
| 627 | t.Parallel() |
| 628 | |
| 629 | // make a test impl object |
| 630 | var mockedService = new(TestExampleImplementation) |
| 631 | |
| 632 | mock1 := mockedService. |
| 633 | On("TheExampleMethod1", 1, 1). |
| 634 | Return(1) |
| 635 | |
| 636 | assert.Equal(t, 1, len(mockedService.ExpectedCalls)) |
| 637 | mock1.Unset() |
| 638 | assert.Equal(t, 0, len(mockedService.ExpectedCalls)) |
| 639 | |
| 640 | assert.Panics(t, func() { |
| 641 | mock1.Unset() |
| 642 | }) |
| 643 | |
| 644 | assert.Equal(t, 0, len(mockedService.ExpectedCalls)) |
| 645 | } |
| 646 | |
| 647 | func Test_Mock_UnsetByOnMethodSpec(t *testing.T) { |
| 648 | t.Parallel() |