mock

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MarshallerMock

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

func (mock *MarshallerMock) Marshal(s interface{}) ([]byte, error)

Marshal calls MarshalFunc.

func (*MarshallerMock) MarshalCalls

func (mock *MarshallerMock) MarshalCalls() []struct {
	S interface{}
}

MarshalCalls gets all the calls that were made to Marshal. Check the length with:

len(mockedMarshaller.MarshalCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL