Documentation
¶
Overview ¶
Package mockpublishers provides moq-generated mocks for the messagequeue package's Publisher, PublisherProvider, Consumer, and ConsumerProvider interfaces.
Index ¶
- type ConsumerMock
- type ConsumerProviderMock
- type PublisherMock
- func (mock *PublisherMock) Publish(ctx context.Context, data any) error
- func (mock *PublisherMock) PublishAsync(ctx context.Context, data any)
- func (mock *PublisherMock) PublishAsyncCalls() []struct{ ... }
- func (mock *PublisherMock) PublishCalls() []struct{ ... }
- func (mock *PublisherMock) Stop()
- func (mock *PublisherMock) StopCalls() []struct{}
- type PublisherProviderMock
- func (mock *PublisherProviderMock) Close()
- func (mock *PublisherProviderMock) CloseCalls() []struct{}
- func (mock *PublisherProviderMock) Ping(ctx context.Context) error
- func (mock *PublisherProviderMock) PingCalls() []struct{ ... }
- func (mock *PublisherProviderMock) ProvidePublisher(ctx context.Context, topic string) (messagequeue.Publisher, error)
- func (mock *PublisherProviderMock) ProvidePublisherCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsumerMock ¶
type ConsumerMock struct {
// ConsumeFunc mocks the Consume method.
ConsumeFunc func(ctx context.Context, stopChan chan bool, errors chan error)
// contains filtered or unexported fields
}
ConsumerMock is a mock implementation of messagequeue.Consumer.
func TestSomethingThatUsesConsumer(t *testing.T) {
// make and configure a mocked messagequeue.Consumer
mockedConsumer := &ConsumerMock{
ConsumeFunc: func(ctx context.Context, stopChan chan bool, errors chan error) {
panic("mock out the Consume method")
},
}
// use mockedConsumer in code that requires messagequeue.Consumer
// and then make assertions.
}
func (*ConsumerMock) Consume ¶
func (mock *ConsumerMock) Consume(ctx context.Context, stopChan chan bool, errors chan error)
Consume calls ConsumeFunc.
func (*ConsumerMock) ConsumeCalls ¶
func (mock *ConsumerMock) ConsumeCalls() []struct { Ctx context.Context StopChan chan bool Errors chan error }
ConsumeCalls gets all the calls that were made to Consume. Check the length with:
len(mockedConsumer.ConsumeCalls())
type ConsumerProviderMock ¶
type ConsumerProviderMock struct {
// ProvideConsumerFunc mocks the ProvideConsumer method.
ProvideConsumerFunc func(ctx context.Context, topic string, handlerFunc messagequeue.ConsumerFunc) (messagequeue.Consumer, error)
// contains filtered or unexported fields
}
ConsumerProviderMock is a mock implementation of messagequeue.ConsumerProvider.
func TestSomethingThatUsesConsumerProvider(t *testing.T) {
// make and configure a mocked messagequeue.ConsumerProvider
mockedConsumerProvider := &ConsumerProviderMock{
ProvideConsumerFunc: func(ctx context.Context, topic string, handlerFunc messagequeue.ConsumerFunc) (messagequeue.Consumer, error) {
panic("mock out the ProvideConsumer method")
},
}
// use mockedConsumerProvider in code that requires messagequeue.ConsumerProvider
// and then make assertions.
}
func (*ConsumerProviderMock) ProvideConsumer ¶
func (mock *ConsumerProviderMock) ProvideConsumer(ctx context.Context, topic string, handlerFunc messagequeue.ConsumerFunc) (messagequeue.Consumer, error)
ProvideConsumer calls ProvideConsumerFunc.
func (*ConsumerProviderMock) ProvideConsumerCalls ¶
func (mock *ConsumerProviderMock) ProvideConsumerCalls() []struct { Ctx context.Context Topic string HandlerFunc messagequeue.ConsumerFunc }
ProvideConsumerCalls gets all the calls that were made to ProvideConsumer. Check the length with:
len(mockedConsumerProvider.ProvideConsumerCalls())
type PublisherMock ¶
type PublisherMock struct {
// PublishFunc mocks the Publish method.
PublishFunc func(ctx context.Context, data any) error
// PublishAsyncFunc mocks the PublishAsync method.
PublishAsyncFunc func(ctx context.Context, data any)
// StopFunc mocks the Stop method.
StopFunc func()
// contains filtered or unexported fields
}
PublisherMock is a mock implementation of messagequeue.Publisher.
func TestSomethingThatUsesPublisher(t *testing.T) {
// make and configure a mocked messagequeue.Publisher
mockedPublisher := &PublisherMock{
PublishFunc: func(ctx context.Context, data any) error {
panic("mock out the Publish method")
},
PublishAsyncFunc: func(ctx context.Context, data any) {
panic("mock out the PublishAsync method")
},
StopFunc: func() {
panic("mock out the Stop method")
},
}
// use mockedPublisher in code that requires messagequeue.Publisher
// and then make assertions.
}
func (*PublisherMock) Publish ¶
func (mock *PublisherMock) Publish(ctx context.Context, data any) error
Publish calls PublishFunc.
func (*PublisherMock) PublishAsync ¶
func (mock *PublisherMock) PublishAsync(ctx context.Context, data any)
PublishAsync calls PublishAsyncFunc.
func (*PublisherMock) PublishAsyncCalls ¶
func (mock *PublisherMock) PublishAsyncCalls() []struct { Ctx context.Context Data any }
PublishAsyncCalls gets all the calls that were made to PublishAsync. Check the length with:
len(mockedPublisher.PublishAsyncCalls())
func (*PublisherMock) PublishCalls ¶
func (mock *PublisherMock) PublishCalls() []struct { Ctx context.Context Data any }
PublishCalls gets all the calls that were made to Publish. Check the length with:
len(mockedPublisher.PublishCalls())
func (*PublisherMock) StopCalls ¶
func (mock *PublisherMock) StopCalls() []struct { }
StopCalls gets all the calls that were made to Stop. Check the length with:
len(mockedPublisher.StopCalls())
type PublisherProviderMock ¶
type PublisherProviderMock struct {
// CloseFunc mocks the Close method.
CloseFunc func()
// PingFunc mocks the Ping method.
PingFunc func(ctx context.Context) error
// ProvidePublisherFunc mocks the ProvidePublisher method.
ProvidePublisherFunc func(ctx context.Context, topic string) (messagequeue.Publisher, error)
// contains filtered or unexported fields
}
PublisherProviderMock is a mock implementation of messagequeue.PublisherProvider.
func TestSomethingThatUsesPublisherProvider(t *testing.T) {
// make and configure a mocked messagequeue.PublisherProvider
mockedPublisherProvider := &PublisherProviderMock{
CloseFunc: func() {
panic("mock out the Close method")
},
PingFunc: func(ctx context.Context) error {
panic("mock out the Ping method")
},
ProvidePublisherFunc: func(ctx context.Context, topic string) (messagequeue.Publisher, error) {
panic("mock out the ProvidePublisher method")
},
}
// use mockedPublisherProvider in code that requires messagequeue.PublisherProvider
// and then make assertions.
}
func (*PublisherProviderMock) Close ¶
func (mock *PublisherProviderMock) Close()
Close calls CloseFunc.
func (*PublisherProviderMock) CloseCalls ¶
func (mock *PublisherProviderMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedPublisherProvider.CloseCalls())
func (*PublisherProviderMock) Ping ¶
func (mock *PublisherProviderMock) Ping(ctx context.Context) error
Ping calls PingFunc.
func (*PublisherProviderMock) PingCalls ¶
func (mock *PublisherProviderMock) PingCalls() []struct { Ctx context.Context }
PingCalls gets all the calls that were made to Ping. Check the length with:
len(mockedPublisherProvider.PingCalls())
func (*PublisherProviderMock) ProvidePublisher ¶
func (mock *PublisherProviderMock) ProvidePublisher(ctx context.Context, topic string) (messagequeue.Publisher, error)
ProvidePublisher calls ProvidePublisherFunc.
func (*PublisherProviderMock) ProvidePublisherCalls ¶
func (mock *PublisherProviderMock) ProvidePublisherCalls() []struct { Ctx context.Context Topic string }
ProvidePublisherCalls gets all the calls that were made to ProvidePublisher. Check the length with:
len(mockedPublisherProvider.ProvidePublisherCalls())