mock

package
v2.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SubscriberMock

type SubscriberMock struct {
	// OnHealthUpdateFunc mocks the OnHealthUpdate method.
	OnHealthUpdateFunc func(status string)
	// contains filtered or unexported fields
}

SubscriberMock is a mock implementation of healthcheck.Subscriber.

    func TestSomethingThatUsesSubscriber(t *testing.T) {

        // make and configure a mocked healthcheck.Subscriber
        mockedSubscriber := &SubscriberMock{
            OnHealthUpdateFunc: func(status string)  {
	               panic("mock out the OnHealthUpdate method")
            },
        }

        // use mockedSubscriber in code that requires healthcheck.Subscriber
        // and then make assertions.

    }

func (*SubscriberMock) OnHealthUpdate

func (mock *SubscriberMock) OnHealthUpdate(status string)

OnHealthUpdate calls OnHealthUpdateFunc.

func (*SubscriberMock) OnHealthUpdateCalls

func (mock *SubscriberMock) OnHealthUpdateCalls() []struct {
	Status string
}

OnHealthUpdateCalls gets all the calls that were made to OnHealthUpdate. Check the length with:

len(mockedSubscriber.OnHealthUpdateCalls())

Jump to

Keyboard shortcuts

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