Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisMock ¶
type RedisMock struct {
// CheckerFunc mocks the Checker method.
CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
// GetValueFunc mocks the GetValue method.
GetValueFunc func(ctx context.Context, key string) (string, error)
// contains filtered or unexported fields
}
RedisMock is a mock implementation of store.Redis.
func TestSomethingThatUsesRedis(t *testing.T) {
// make and configure a mocked store.Redis
mockedRedis := &RedisMock{
CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
panic("mock out the Checker method")
},
GetValueFunc: func(ctx context.Context, key string) (string, error) {
panic("mock out the GetValue method")
},
}
// use mockedRedis in code that requires store.Redis
// and then make assertions.
}
func (*RedisMock) Checker ¶
func (mock *RedisMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
Checker calls CheckerFunc.
func (*RedisMock) CheckerCalls ¶
func (mock *RedisMock) CheckerCalls() []struct { ContextMoqParam context.Context CheckState *healthcheck.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedRedis.CheckerCalls())
type StorerMock ¶
type StorerMock struct {
// CheckerFunc mocks the Checker method.
CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error
// GetValueFunc mocks the GetValue method.
GetValueFunc func(ctx context.Context, key string) (string, error)
// contains filtered or unexported fields
}
StorerMock is a mock implementation of store.Storer.
func TestSomethingThatUsesStorer(t *testing.T) {
// make and configure a mocked store.Storer
mockedStorer := &StorerMock{
CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
panic("mock out the Checker method")
},
GetValueFunc: func(ctx context.Context, key string) (string, error) {
panic("mock out the GetValue method")
},
}
// use mockedStorer in code that requires store.Storer
// and then make assertions.
}
func (*StorerMock) Checker ¶
func (mock *StorerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error
Checker calls CheckerFunc.
func (*StorerMock) CheckerCalls ¶
func (mock *StorerMock) CheckerCalls() []struct { Ctx context.Context State *healthcheck.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedStorer.CheckerCalls())
func (*StorerMock) GetValueCalls ¶
func (mock *StorerMock) GetValueCalls() []struct { Ctx context.Context Key string }
GetValueCalls gets all the calls that were made to GetValue. Check the length with:
len(mockedStorer.GetValueCalls())
Click to show internal directories.
Click to hide internal directories.