Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerMock ¶
type HandlerMock struct {
// HandleFunc mocks the Handle method.
HandleFunc func(ctx context.Context, cfg *config.Config, contentPublished *models.ContentPublished) error
// contains filtered or unexported fields
}
HandlerMock is a mock implementation of event.Handler.
func TestSomethingThatUsesHandler(t *testing.T) {
// make and configure a mocked event.Handler
mockedHandler := &HandlerMock{
HandleFunc: func(ctx context.Context, cfg *config.Config, contentPublished *models.ContentPublished) error {
panic("mock out the Handle method")
},
}
// use mockedHandler in code that requires event.Handler
// and then make assertions.
}
func (*HandlerMock) Handle ¶
func (mock *HandlerMock) Handle(ctx context.Context, cfg *config.Config, contentPublished *models.ContentPublished) error
Handle calls HandleFunc.
func (*HandlerMock) HandleCalls ¶
func (mock *HandlerMock) HandleCalls() []struct { Ctx context.Context Cfg *config.Config ContentPublished *models.ContentPublished }
HandleCalls gets all the calls that were made to Handle. Check the length with:
len(mockedHandler.HandleCalls())
type MarshallerMock ¶ added in v0.2.0
type MarshallerMock struct {
// MarshalFunc mocks the Marshal method.
MarshalFunc func(s interface{}) ([]byte, error)
// contains filtered or unexported fields
}
MarshallerMock is a mock implementation of event.Marshaller.
func TestSomethingThatUsesMarshaller(t *testing.T) {
// make and configure a mocked event.Marshaller
mockedMarshaller := &MarshallerMock{
MarshalFunc: func(s interface{}) ([]byte, error) {
panic("mock out the Marshal method")
},
}
// use mockedMarshaller in code that requires event.Marshaller
// and then make assertions.
}
func (*MarshallerMock) Marshal ¶ added in v0.2.0
func (mock *MarshallerMock) Marshal(s interface{}) ([]byte, error)
Marshal calls MarshalFunc.
func (*MarshallerMock) MarshalCalls ¶ added in v0.2.0
func (mock *MarshallerMock) MarshalCalls() []struct { S interface{} }
MarshalCalls gets all the calls that were made to Marshal. Check the length with:
len(mockedMarshaller.MarshalCalls())
Click to show internal directories.
Click to hide internal directories.