Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hasher ¶
type Hasher interface { // ReceiverHash calculates the hash of a receiver based on the // given configuration ReceiverHash(config interface{}) (string, error) }
Hasher defines the hashing interface that a receiver needs to implement
type HasherMock ¶
type HasherMock struct { // ReceiverHashFunc mocks the ReceiverHash method. ReceiverHashFunc func(config interface{}) (string, error) // contains filtered or unexported fields }
HasherMock is a mock implementation of Hasher.
func TestSomethingThatUsesHasher(t *testing.T) { // make and configure a mocked Hasher mockedHasher := &HasherMock{ ReceiverHashFunc: func(config interface{}) (string, error) { panic("mock out the ReceiverHash method") }, } // use mockedHasher in code that requires Hasher // and then make assertions. }
func (*HasherMock) ReceiverHash ¶
func (mock *HasherMock) ReceiverHash(config interface{}) (string, error)
ReceiverHash calls ReceiverHashFunc.
func (*HasherMock) ReceiverHashCalls ¶
func (mock *HasherMock) ReceiverHashCalls() []struct { Config interface{} }
ReceiverHashCalls gets all the calls that were made to ReceiverHash. Check the length with:
len(mockedHasher.ReceiverHashCalls())
type InvalidConfigError ¶
type InvalidConfigError struct {
Err error
}
InvalidConfigError is returned when a bad configuration is passed into the New* functions
func (*InvalidConfigError) Error ¶
func (e *InvalidConfigError) Error() string
func (*InvalidConfigError) Unwrap ¶
func (e *InvalidConfigError) Unwrap() error
type NewReceiverer ¶
type NewReceivererMock ¶
type NewReceivererMock struct { // NewReceiverFunc mocks the NewReceiver method. NewReceiverFunc func(config interface{}) (Receiver, error) // ReceiverHashFunc mocks the ReceiverHash method. ReceiverHashFunc func(config interface{}) (string, error) // contains filtered or unexported fields }
NewReceivererMock is a mock implementation of NewReceiverer.
func TestSomethingThatUsesNewReceiverer(t *testing.T) { // make and configure a mocked NewReceiverer mockedNewReceiverer := &NewReceivererMock{ NewReceiverFunc: func(config interface{}) (Receiver, error) { panic("mock out the NewReceiver method") }, ReceiverHashFunc: func(config interface{}) (string, error) { panic("mock out the ReceiverHash method") }, } // use mockedNewReceiverer in code that requires NewReceiverer // and then make assertions. }
func (*NewReceivererMock) NewReceiver ¶
func (mock *NewReceivererMock) NewReceiver(config interface{}) (Receiver, error)
NewReceiver calls NewReceiverFunc.
func (*NewReceivererMock) NewReceiverCalls ¶
func (mock *NewReceivererMock) NewReceiverCalls() []struct { Config interface{} }
NewReceiverCalls gets all the calls that were made to NewReceiver. Check the length with:
len(mockedNewReceiverer.NewReceiverCalls())
func (*NewReceivererMock) ReceiverHash ¶
func (mock *NewReceivererMock) ReceiverHash(config interface{}) (string, error)
ReceiverHash calls ReceiverHashFunc.
func (*NewReceivererMock) ReceiverHashCalls ¶
func (mock *NewReceivererMock) ReceiverHashCalls() []struct { Config interface{} }
ReceiverHashCalls gets all the calls that were made to ReceiverHash. Check the length with:
len(mockedNewReceiverer.ReceiverHashCalls())
type Receiver ¶
type Receiver interface { Receive(next NextFn) error // StopReceiving will stop the receiver from receiving events. // This will cause Receive to return. StopReceiving(ctx context.Context) error }
Receiver is a plugin that will receive messages and will send them to `NextFn`
type ReceiverMock ¶
type ReceiverMock struct { // ReceiveFunc mocks the Receive method. ReceiveFunc func(next NextFn) error // StopReceivingFunc mocks the StopReceiving method. StopReceivingFunc func(ctx context.Context) error // contains filtered or unexported fields }
ReceiverMock is a mock implementation of Receiver.
func TestSomethingThatUsesReceiver(t *testing.T) { // make and configure a mocked Receiver mockedReceiver := &ReceiverMock{ ReceiveFunc: func(next NextFn) error { panic("mock out the Receive method") }, StopReceivingFunc: func(ctx context.Context) error { panic("mock out the StopReceiving method") }, } // use mockedReceiver in code that requires Receiver // and then make assertions. }
func (*ReceiverMock) Receive ¶
func (mock *ReceiverMock) Receive(next NextFn) error
Receive calls ReceiveFunc.
func (*ReceiverMock) ReceiveCalls ¶
func (mock *ReceiverMock) ReceiveCalls() []struct { Next NextFn }
ReceiveCalls gets all the calls that were made to Receive. Check the length with:
len(mockedReceiver.ReceiveCalls())
func (*ReceiverMock) StopReceiving ¶
func (mock *ReceiverMock) StopReceiving(ctx context.Context) error
StopReceiving calls StopReceivingFunc.
func (*ReceiverMock) StopReceivingCalls ¶
func (mock *ReceiverMock) StopReceivingCalls() []struct { Ctx context.Context }
StopReceivingCalls gets all the calls that were made to StopReceiving. Check the length with:
len(mockedReceiver.StopReceivingCalls())