Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerMock ¶
type HandlerMock struct { // ServeHTTPFunc mocks the ServeHTTP method. ServeHTTPFunc func(in1 http.ResponseWriter, in2 *http.Request) // contains filtered or unexported fields }
HandlerMock is a mock implementation of abtest.Handler.
func TestSomethingThatUsesHandler(t *testing.T) { // make and configure a mocked abtest.Handler mockedHandler := &HandlerMock{ ServeHTTPFunc: func(in1 http.ResponseWriter, in2 *http.Request) { panic("mock out the ServeHTTP method") }, } // use mockedHandler in code that requires abtest.Handler // and then make assertions. }
func (*HandlerMock) ServeHTTP ¶
func (mock *HandlerMock) ServeHTTP(in1 http.ResponseWriter, in2 *http.Request)
ServeHTTP calls ServeHTTPFunc.
func (*HandlerMock) ServeHTTPCalls ¶
func (mock *HandlerMock) ServeHTTPCalls() []struct { In1 http.ResponseWriter In2 *http.Request }
ServeHTTPCalls gets all the calls that were made to ServeHTTP. Check the length with:
len(mockedHandler.ServeHTTPCalls())
Click to show internal directories.
Click to hide internal directories.