mock

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoServerMock

type MongoServerMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error

	// CloseFunc mocks the Close method.
	CloseFunc func(ctx context.Context) error
	// contains filtered or unexported fields
}

MongoServerMock is a mock implementation of api.MongoServer.

    func TestSomethingThatUsesMongoServer(t *testing.T) {

        // make and configure a mocked api.MongoServer
        mockedMongoServer := &MongoServerMock{
            CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            CloseFunc: func(ctx context.Context) error {
	               panic("mock out the Close method")
            },
        }

        // use mockedMongoServer in code that requires api.MongoServer
        // and then make assertions.

    }

func (*MongoServerMock) Checker

func (mock *MongoServerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*MongoServerMock) CheckerCalls

func (mock *MongoServerMock) CheckerCalls() []struct {
	Ctx   context.Context
	State *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedMongoServer.CheckerCalls())

func (*MongoServerMock) Close

func (mock *MongoServerMock) Close(ctx context.Context) error

Close calls CloseFunc.

func (*MongoServerMock) CloseCalls

func (mock *MongoServerMock) CloseCalls() []struct {
	Ctx context.Context
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedMongoServer.CloseCalls())

Jump to

Keyboard shortcuts

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