prompterMock is a mock implementation of prompter. func TestSomethingThatUsesprompter(t *testing.T) { // make and configure a mocked prompter mockedprompter := &prompterMock{ ConfirmFunc: func(message string) (bool, error) { panic("mock out the Confirm method") }, } // use mock
| 23 | // |
| 24 | // } |
| 25 | type prompterMock struct { |
| 26 | // ConfirmFunc mocks the Confirm method. |
| 27 | ConfirmFunc func(message string) (bool, error) |
| 28 | |
| 29 | // calls tracks calls to the methods. |
| 30 | calls struct { |
| 31 | // Confirm holds details about calls to the Confirm method. |
| 32 | Confirm []struct { |
| 33 | // Message is the message argument value. |
| 34 | Message string |
| 35 | } |
| 36 | } |
| 37 | lockConfirm sync.RWMutex |
| 38 | } |
| 39 | |
| 40 | // Confirm calls ConfirmFunc. |
| 41 | func (mock *prompterMock) Confirm(message string) (bool, error) { |
nothing calls this directly
no outgoing calls
no test coverage detected