errorstest

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 3 Imported by: 0

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, filterID string, err error)
	// contains filtered or unexported fields
}

HandlerMock is a mock implementation of errors.Handler.

    func TestSomethingThatUsesHandler(t *testing.T) {

        // make and configure a mocked errors.Handler
        mockedHandler := &HandlerMock{
            HandleFunc: func(ctx context.Context, filterID string, err error)  {
	               panic("mock out the Handle method")
            },
        }

        // use mockedHandler in code that requires errors.Handler
        // and then make assertions.

    }

func (*HandlerMock) Handle

func (mock *HandlerMock) Handle(ctx context.Context, filterID string, err error)

Handle calls HandleFunc.

func (*HandlerMock) HandleCalls

func (mock *HandlerMock) HandleCalls() []struct {
	Ctx      context.Context
	FilterID string
	Err      error
}

HandleCalls gets all the calls that were made to Handle. Check the length with:

len(mockedHandler.HandleCalls())

Jump to

Keyboard shortcuts

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