Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIMock ¶
type APIMock struct { // StartFunc mocks the Start method. StartFunc func(port string) error // contains filtered or unexported fields }
APIMock is a mock implementation of API.
func TestSomethingThatUsesAPI(t *testing.T) { // make and configure a mocked API mockedAPI := &APIMock{ StartFunc: func(port string) error { panic("mock out the Start method") }, } // use mockedAPI in code that requires API // and then make assertions. }
func (*APIMock) StartCalls ¶
StartCalls gets all the calls that were made to Start. Check the length with:
len(mockedAPI.StartCalls())
Click to show internal directories.
Click to hide internal directories.