mocks

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitterMock

type CommitterMock struct {
	// CommitFunc mocks the Commit method.
	CommitFunc func() error

	// RollbackFunc mocks the Rollback method.
	RollbackFunc func() error
	// contains filtered or unexported fields
}

CommitterMock is a mock implementation of Committer.

    func TestSomethingThatUsesCommitter(t *testing.T) {

        // make and configure a mocked Committer
        mockedCommitter := &CommitterMock{
            CommitFunc: func() error {
	               panic("mock out the Commit method")
            },
            RollbackFunc: func() error {
	               panic("mock out the Rollback method")
            },
        }

        // use mockedCommitter in code that requires Committer
        // and then make assertions.

    }

func (*CommitterMock) Commit

func (mock *CommitterMock) Commit() error

Commit calls CommitFunc.

func (*CommitterMock) CommitCalls

func (mock *CommitterMock) CommitCalls() []struct {
}

CommitCalls gets all the calls that were made to Commit. Check the length with:

len(mockedCommitter.CommitCalls())

func (*CommitterMock) Rollback

func (mock *CommitterMock) Rollback() error

Rollback calls RollbackFunc.

func (*CommitterMock) RollbackCalls

func (mock *CommitterMock) RollbackCalls() []struct {
}

RollbackCalls gets all the calls that were made to Rollback. Check the length with:

len(mockedCommitter.RollbackCalls())

type DataStoreMock

type DataStoreMock struct {
	// BeginTxFunc mocks the BeginTx method.
	BeginTxFunc func(ctx context.Context) (persistence.Tx, persistence.Committer, error)
	// contains filtered or unexported fields
}

DataStoreMock is a mock implementation of DataStore.

    func TestSomethingThatUsesDataStore(t *testing.T) {

        // make and configure a mocked DataStore
        mockedDataStore := &DataStoreMock{
            BeginTxFunc: func(ctx context.Context) (persistence.Tx, persistence.Committer, error) {
	               panic("mock out the BeginTx method")
            },
        }

        // use mockedDataStore in code that requires DataStore
        // and then make assertions.

    }

func (*DataStoreMock) BeginTx

BeginTx calls BeginTxFunc.

func (*DataStoreMock) BeginTxCalls

func (mock *DataStoreMock) BeginTxCalls() []struct {
	Ctx context.Context
}

BeginTxCalls gets all the calls that were made to BeginTx. Check the length with:

len(mockedDataStore.BeginTxCalls())

type InboundPipelineMock

type InboundPipelineMock struct {
	// AcceptFunc mocks the Accept method.
	AcceptFunc func(ctx context.Context, sink endpoint.MessageSink, env endpoint.InboundEnvelope) error

	// InitializeFunc mocks the Initialize method.
	InitializeFunc func(ctx context.Context, ep *endpoint.Endpoint) error
	// contains filtered or unexported fields
}

InboundPipelineMock is a mock implementation of InboundPipeline.

    func TestSomethingThatUsesInboundPipeline(t *testing.T) {

        // make and configure a mocked InboundPipeline
        mockedInboundPipeline := &InboundPipelineMock{
            AcceptFunc: func(ctx context.Context, sink endpoint.MessageSink, env endpoint.InboundEnvelope) error {
	               panic("mock out the Accept method")
            },
            InitializeFunc: func(ctx context.Context, ep *endpoint.Endpoint) error {
	               panic("mock out the Initialize method")
            },
        }

        // use mockedInboundPipeline in code that requires InboundPipeline
        // and then make assertions.

    }

func (*InboundPipelineMock) Accept

Accept calls AcceptFunc.

func (*InboundPipelineMock) AcceptCalls

func (mock *InboundPipelineMock) AcceptCalls() []struct {
	Ctx  context.Context
	Sink endpoint.MessageSink
	Env  endpoint.InboundEnvelope
}

AcceptCalls gets all the calls that were made to Accept. Check the length with:

len(mockedInboundPipeline.AcceptCalls())

func (*InboundPipelineMock) Initialize

func (mock *InboundPipelineMock) Initialize(ctx context.Context, ep *endpoint.Endpoint) error

Initialize calls InitializeFunc.

func (*InboundPipelineMock) InitializeCalls

func (mock *InboundPipelineMock) InitializeCalls() []struct {
	Ctx context.Context
	Ep  *endpoint.Endpoint
}

InitializeCalls gets all the calls that were made to Initialize. Check the length with:

len(mockedInboundPipeline.InitializeCalls())

type InboundTransportMock

type InboundTransportMock struct {
	// InitializeFunc mocks the Initialize method.
	InitializeFunc func(ctx context.Context, ep string) error

	// ReceiveFunc mocks the Receive method.
	ReceiveFunc func(ctx context.Context) (endpoint.InboundEnvelope, endpoint.Acknowledger, error)

	// SubscribeFunc mocks the Subscribe method.
	SubscribeFunc func(ctx context.Context, op endpoint.Operation, mt ax.MessageTypeSet) error
	// contains filtered or unexported fields
}

InboundTransportMock is a mock implementation of InboundTransport.

    func TestSomethingThatUsesInboundTransport(t *testing.T) {

        // make and configure a mocked InboundTransport
        mockedInboundTransport := &InboundTransportMock{
            InitializeFunc: func(ctx context.Context, ep string) error {
	               panic("mock out the Initialize method")
            },
            ReceiveFunc: func(ctx context.Context) (endpoint.InboundEnvelope, endpoint.Acknowledger, error) {
	               panic("mock out the Receive method")
            },
            SubscribeFunc: func(ctx context.Context, op endpoint.Operation, mt ax.MessageTypeSet) error {
	               panic("mock out the Subscribe method")
            },
        }

        // use mockedInboundTransport in code that requires InboundTransport
        // and then make assertions.

    }

func (*InboundTransportMock) Initialize

func (mock *InboundTransportMock) Initialize(ctx context.Context, ep string) error

Initialize calls InitializeFunc.

func (*InboundTransportMock) InitializeCalls

func (mock *InboundTransportMock) InitializeCalls() []struct {
	Ctx context.Context
	Ep  string
}

InitializeCalls gets all the calls that were made to Initialize. Check the length with:

len(mockedInboundTransport.InitializeCalls())

func (*InboundTransportMock) Receive

Receive calls ReceiveFunc.

func (*InboundTransportMock) ReceiveCalls

func (mock *InboundTransportMock) ReceiveCalls() []struct {
	Ctx context.Context
}

ReceiveCalls gets all the calls that were made to Receive. Check the length with:

len(mockedInboundTransport.ReceiveCalls())

func (*InboundTransportMock) Subscribe

Subscribe calls SubscribeFunc.

func (*InboundTransportMock) SubscribeCalls

func (mock *InboundTransportMock) SubscribeCalls() []struct {
	Ctx context.Context
	Op  endpoint.Operation
	Mt  ax.MessageTypeSet
}

SubscribeCalls gets all the calls that were made to Subscribe. Check the length with:

len(mockedInboundTransport.SubscribeCalls())

type MessageHandlerMock

type MessageHandlerMock struct {
	// HandleMessageFunc mocks the HandleMessage method.
	HandleMessageFunc func(ctx context.Context, s ax.Sender, mctx ax.MessageContext) error

	// MessageTypesFunc mocks the MessageTypes method.
	MessageTypesFunc func() ax.MessageTypeSet
	// contains filtered or unexported fields
}

MessageHandlerMock is a mock implementation of MessageHandler.

    func TestSomethingThatUsesMessageHandler(t *testing.T) {

        // make and configure a mocked MessageHandler
        mockedMessageHandler := &MessageHandlerMock{
            HandleMessageFunc: func(ctx context.Context, s ax.Sender, mctx ax.MessageContext) error {
	               panic("mock out the HandleMessage method")
            },
            MessageTypesFunc: func() ax.MessageTypeSet {
	               panic("mock out the MessageTypes method")
            },
        }

        // use mockedMessageHandler in code that requires MessageHandler
        // and then make assertions.

    }

func (*MessageHandlerMock) HandleMessage

func (mock *MessageHandlerMock) HandleMessage(ctx context.Context, s ax.Sender, mctx ax.MessageContext) error

HandleMessage calls HandleMessageFunc.

func (*MessageHandlerMock) HandleMessageCalls

func (mock *MessageHandlerMock) HandleMessageCalls() []struct {
	Ctx  context.Context
	S    ax.Sender
	Mctx ax.MessageContext
}

HandleMessageCalls gets all the calls that were made to HandleMessage. Check the length with:

len(mockedMessageHandler.HandleMessageCalls())

func (*MessageHandlerMock) MessageTypes

func (mock *MessageHandlerMock) MessageTypes() ax.MessageTypeSet

MessageTypes calls MessageTypesFunc.

func (*MessageHandlerMock) MessageTypesCalls

func (mock *MessageHandlerMock) MessageTypesCalls() []struct {
}

MessageTypesCalls gets all the calls that were made to MessageTypes. Check the length with:

len(mockedMessageHandler.MessageTypesCalls())

type MessageSinkMock

type MessageSinkMock struct {
	// AcceptFunc mocks the Accept method.
	AcceptFunc func(ctx context.Context, env endpoint.OutboundEnvelope) error
	// contains filtered or unexported fields
}

MessageSinkMock is a mock implementation of MessageSink.

    func TestSomethingThatUsesMessageSink(t *testing.T) {

        // make and configure a mocked MessageSink
        mockedMessageSink := &MessageSinkMock{
            AcceptFunc: func(ctx context.Context, env endpoint.OutboundEnvelope) error {
	               panic("mock out the Accept method")
            },
        }

        // use mockedMessageSink in code that requires MessageSink
        // and then make assertions.

    }

func (*MessageSinkMock) Accept

Accept calls AcceptFunc.

func (*MessageSinkMock) AcceptCalls

func (mock *MessageSinkMock) AcceptCalls() []struct {
	Ctx context.Context
	Env endpoint.OutboundEnvelope
}

AcceptCalls gets all the calls that were made to Accept. Check the length with:

len(mockedMessageSink.AcceptCalls())

type ObserverMock

type ObserverMock struct {
	// AfterInboundFunc mocks the AfterInbound method.
	AfterInboundFunc func(ctx context.Context, env endpoint.InboundEnvelope, err error)

	// AfterOutboundFunc mocks the AfterOutbound method.
	AfterOutboundFunc func(ctx context.Context, env endpoint.OutboundEnvelope, err error)

	// BeforeInboundFunc mocks the BeforeInbound method.
	BeforeInboundFunc func(ctx context.Context, env endpoint.InboundEnvelope)

	// BeforeOutboundFunc mocks the BeforeOutbound method.
	BeforeOutboundFunc func(ctx context.Context, env endpoint.OutboundEnvelope)
	// contains filtered or unexported fields
}

ObserverMock is a mock implementation of Observer.

    func TestSomethingThatUsesObserver(t *testing.T) {

        // make and configure a mocked Observer
        mockedObserver := &ObserverMock{
            AfterInboundFunc: func(ctx context.Context, env endpoint.InboundEnvelope, err error)  {
	               panic("mock out the AfterInbound method")
            },
            AfterOutboundFunc: func(ctx context.Context, env endpoint.OutboundEnvelope, err error)  {
	               panic("mock out the AfterOutbound method")
            },
            BeforeInboundFunc: func(ctx context.Context, env endpoint.InboundEnvelope)  {
	               panic("mock out the BeforeInbound method")
            },
            BeforeOutboundFunc: func(ctx context.Context, env endpoint.OutboundEnvelope)  {
	               panic("mock out the BeforeOutbound method")
            },
        }

        // use mockedObserver in code that requires Observer
        // and then make assertions.

    }

func (*ObserverMock) AfterInbound

func (mock *ObserverMock) AfterInbound(ctx context.Context, env endpoint.InboundEnvelope, err error)

AfterInbound calls AfterInboundFunc.

func (*ObserverMock) AfterInboundCalls

func (mock *ObserverMock) AfterInboundCalls() []struct {
	Ctx context.Context
	Env endpoint.InboundEnvelope
	Err error
}

AfterInboundCalls gets all the calls that were made to AfterInbound. Check the length with:

len(mockedObserver.AfterInboundCalls())

func (*ObserverMock) AfterOutbound

func (mock *ObserverMock) AfterOutbound(ctx context.Context, env endpoint.OutboundEnvelope, err error)

AfterOutbound calls AfterOutboundFunc.

func (*ObserverMock) AfterOutboundCalls

func (mock *ObserverMock) AfterOutboundCalls() []struct {
	Ctx context.Context
	Env endpoint.OutboundEnvelope
	Err error
}

AfterOutboundCalls gets all the calls that were made to AfterOutbound. Check the length with:

len(mockedObserver.AfterOutboundCalls())

func (*ObserverMock) BeforeInbound

func (mock *ObserverMock) BeforeInbound(ctx context.Context, env endpoint.InboundEnvelope)

BeforeInbound calls BeforeInboundFunc.

func (*ObserverMock) BeforeInboundCalls

func (mock *ObserverMock) BeforeInboundCalls() []struct {
	Ctx context.Context
	Env endpoint.InboundEnvelope
}

BeforeInboundCalls gets all the calls that were made to BeforeInbound. Check the length with:

len(mockedObserver.BeforeInboundCalls())

func (*ObserverMock) BeforeOutbound

func (mock *ObserverMock) BeforeOutbound(ctx context.Context, env endpoint.OutboundEnvelope)

BeforeOutbound calls BeforeOutboundFunc.

func (*ObserverMock) BeforeOutboundCalls

func (mock *ObserverMock) BeforeOutboundCalls() []struct {
	Ctx context.Context
	Env endpoint.OutboundEnvelope
}

BeforeOutboundCalls gets all the calls that were made to BeforeOutbound. Check the length with:

len(mockedObserver.BeforeOutboundCalls())

type OutboundPipelineMock

type OutboundPipelineMock struct {
	// AcceptFunc mocks the Accept method.
	AcceptFunc func(ctx context.Context, env endpoint.OutboundEnvelope) error

	// InitializeFunc mocks the Initialize method.
	InitializeFunc func(ctx context.Context, ep *endpoint.Endpoint) error
	// contains filtered or unexported fields
}

OutboundPipelineMock is a mock implementation of OutboundPipeline.

    func TestSomethingThatUsesOutboundPipeline(t *testing.T) {

        // make and configure a mocked OutboundPipeline
        mockedOutboundPipeline := &OutboundPipelineMock{
            AcceptFunc: func(ctx context.Context, env endpoint.OutboundEnvelope) error {
	               panic("mock out the Accept method")
            },
            InitializeFunc: func(ctx context.Context, ep *endpoint.Endpoint) error {
	               panic("mock out the Initialize method")
            },
        }

        // use mockedOutboundPipeline in code that requires OutboundPipeline
        // and then make assertions.

    }

func (*OutboundPipelineMock) Accept

Accept calls AcceptFunc.

func (*OutboundPipelineMock) AcceptCalls

func (mock *OutboundPipelineMock) AcceptCalls() []struct {
	Ctx context.Context
	Env endpoint.OutboundEnvelope
}

AcceptCalls gets all the calls that were made to Accept. Check the length with:

len(mockedOutboundPipeline.AcceptCalls())

func (*OutboundPipelineMock) Initialize

func (mock *OutboundPipelineMock) Initialize(ctx context.Context, ep *endpoint.Endpoint) error

Initialize calls InitializeFunc.

func (*OutboundPipelineMock) InitializeCalls

func (mock *OutboundPipelineMock) InitializeCalls() []struct {
	Ctx context.Context
	Ep  *endpoint.Endpoint
}

InitializeCalls gets all the calls that were made to Initialize. Check the length with:

len(mockedOutboundPipeline.InitializeCalls())

type OutboundTransportMock

type OutboundTransportMock struct {
	// InitializeFunc mocks the Initialize method.
	InitializeFunc func(ctx context.Context, ep string) error

	// SendFunc mocks the Send method.
	SendFunc func(ctx context.Context, env endpoint.OutboundEnvelope) error
	// contains filtered or unexported fields
}

OutboundTransportMock is a mock implementation of OutboundTransport.

    func TestSomethingThatUsesOutboundTransport(t *testing.T) {

        // make and configure a mocked OutboundTransport
        mockedOutboundTransport := &OutboundTransportMock{
            InitializeFunc: func(ctx context.Context, ep string) error {
	               panic("mock out the Initialize method")
            },
            SendFunc: func(ctx context.Context, env endpoint.OutboundEnvelope) error {
	               panic("mock out the Send method")
            },
        }

        // use mockedOutboundTransport in code that requires OutboundTransport
        // and then make assertions.

    }

func (*OutboundTransportMock) Initialize

func (mock *OutboundTransportMock) Initialize(ctx context.Context, ep string) error

Initialize calls InitializeFunc.

func (*OutboundTransportMock) InitializeCalls

func (mock *OutboundTransportMock) InitializeCalls() []struct {
	Ctx context.Context
	Ep  string
}

InitializeCalls gets all the calls that were made to Initialize. Check the length with:

len(mockedOutboundTransport.InitializeCalls())

func (*OutboundTransportMock) Send

Send calls SendFunc.

func (*OutboundTransportMock) SendCalls

func (mock *OutboundTransportMock) SendCalls() []struct {
	Ctx context.Context
	Env endpoint.OutboundEnvelope
}

SendCalls gets all the calls that were made to Send. Check the length with:

len(mockedOutboundTransport.SendCalls())

type SelfValidatingMessageMock

type SelfValidatingMessageMock struct {
	// MessageDescriptionFunc mocks the MessageDescription method.
	MessageDescriptionFunc func() string

	// ProtoMessageFunc mocks the ProtoMessage method.
	ProtoMessageFunc func()

	// ResetFunc mocks the Reset method.
	ResetFunc func()

	// StringFunc mocks the String method.
	StringFunc func() string

	// ValidateFunc mocks the Validate method.
	ValidateFunc func() error
	// contains filtered or unexported fields
}

SelfValidatingMessageMock is a mock implementation of SelfValidatingMessage.

    func TestSomethingThatUsesSelfValidatingMessage(t *testing.T) {

        // make and configure a mocked SelfValidatingMessage
        mockedSelfValidatingMessage := &SelfValidatingMessageMock{
            MessageDescriptionFunc: func() string {
	               panic("mock out the MessageDescription method")
            },
            ProtoMessageFunc: func()  {
	               panic("mock out the ProtoMessage method")
            },
            ResetFunc: func()  {
	               panic("mock out the Reset method")
            },
            StringFunc: func() string {
	               panic("mock out the String method")
            },
            ValidateFunc: func() error {
	               panic("mock out the Validate method")
            },
        }

        // use mockedSelfValidatingMessage in code that requires SelfValidatingMessage
        // and then make assertions.

    }

func (*SelfValidatingMessageMock) MessageDescription

func (mock *SelfValidatingMessageMock) MessageDescription() string

MessageDescription calls MessageDescriptionFunc.

func (*SelfValidatingMessageMock) MessageDescriptionCalls

func (mock *SelfValidatingMessageMock) MessageDescriptionCalls() []struct {
}

MessageDescriptionCalls gets all the calls that were made to MessageDescription. Check the length with:

len(mockedSelfValidatingMessage.MessageDescriptionCalls())

func (*SelfValidatingMessageMock) ProtoMessage

func (mock *SelfValidatingMessageMock) ProtoMessage()

ProtoMessage calls ProtoMessageFunc.

func (*SelfValidatingMessageMock) ProtoMessageCalls

func (mock *SelfValidatingMessageMock) ProtoMessageCalls() []struct {
}

ProtoMessageCalls gets all the calls that were made to ProtoMessage. Check the length with:

len(mockedSelfValidatingMessage.ProtoMessageCalls())

func (*SelfValidatingMessageMock) Reset

func (mock *SelfValidatingMessageMock) Reset()

Reset calls ResetFunc.

func (*SelfValidatingMessageMock) ResetCalls

func (mock *SelfValidatingMessageMock) ResetCalls() []struct {
}

ResetCalls gets all the calls that were made to Reset. Check the length with:

len(mockedSelfValidatingMessage.ResetCalls())

func (*SelfValidatingMessageMock) String

func (mock *SelfValidatingMessageMock) String() string

String calls StringFunc.

func (*SelfValidatingMessageMock) StringCalls

func (mock *SelfValidatingMessageMock) StringCalls() []struct {
}

StringCalls gets all the calls that were made to String. Check the length with:

len(mockedSelfValidatingMessage.StringCalls())

func (*SelfValidatingMessageMock) Validate

func (mock *SelfValidatingMessageMock) Validate() error

Validate calls ValidateFunc.

func (*SelfValidatingMessageMock) ValidateCalls

func (mock *SelfValidatingMessageMock) ValidateCalls() []struct {
}

ValidateCalls gets all the calls that were made to Validate. Check the length with:

len(mockedSelfValidatingMessage.ValidateCalls())

type TxMock

type TxMock struct {
	// DataStoreFunc mocks the DataStore method.
	DataStoreFunc func() persistence.DataStore
	// contains filtered or unexported fields
}

TxMock is a mock implementation of Tx.

    func TestSomethingThatUsesTx(t *testing.T) {

        // make and configure a mocked Tx
        mockedTx := &TxMock{
            DataStoreFunc: func() persistence.DataStore {
	               panic("mock out the DataStore method")
            },
        }

        // use mockedTx in code that requires Tx
        // and then make assertions.

    }

func (*TxMock) DataStore

func (mock *TxMock) DataStore() persistence.DataStore

DataStore calls DataStoreFunc.

func (*TxMock) DataStoreCalls

func (mock *TxMock) DataStoreCalls() []struct {
}

DataStoreCalls gets all the calls that were made to DataStore. Check the length with:

len(mockedTx.DataStoreCalls())

type ValidatorMock

type ValidatorMock struct {
	// ValidateFunc mocks the Validate method.
	ValidateFunc func(ctx context.Context, m ax.Message) error
	// contains filtered or unexported fields
}

ValidatorMock is a mock implementation of Validator.

    func TestSomethingThatUsesValidator(t *testing.T) {

        // make and configure a mocked Validator
        mockedValidator := &ValidatorMock{
            ValidateFunc: func(ctx context.Context, m ax.Message) error {
	               panic("mock out the Validate method")
            },
        }

        // use mockedValidator in code that requires Validator
        // and then make assertions.

    }

func (*ValidatorMock) Validate

func (mock *ValidatorMock) Validate(ctx context.Context, m ax.Message) error

Validate calls ValidateFunc.

func (*ValidatorMock) ValidateCalls

func (mock *ValidatorMock) ValidateCalls() []struct {
	Ctx context.Context
	M   ax.Message
}

ValidateCalls gets all the calls that were made to Validate. Check the length with:

len(mockedValidator.ValidateCalls())

Jump to

Keyboard shortcuts

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