mockentity

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BidiStreamMock

type BidiStreamMock struct {
	// CloseFunc mocks the Close method.
	CloseFunc func() error

	// ReceiveFunc mocks the Receive method.
	ReceiveFunc func(res *proto.Message) error

	// SendFunc mocks the Send method.
	SendFunc func(req proto.Message) error
	// contains filtered or unexported fields
}

BidiStreamMock is a mock implementation of BidiStream.

    func TestSomethingThatUsesBidiStream(t *testing.T) {

        // make and configure a mocked BidiStream
        mockedBidiStream := &BidiStreamMock{
            CloseFunc: func() error {
	               panic("TODO: mock out the Close method")
            },
            ReceiveFunc: func(res *proto.Message) error {
	               panic("TODO: mock out the Receive method")
            },
            SendFunc: func(req proto.Message) error {
	               panic("TODO: mock out the Send method")
            },
        }

        // TODO: use mockedBidiStream in code that requires BidiStream
        //       and then make assertions.

    }

func (*BidiStreamMock) Close

func (mock *BidiStreamMock) Close() error

Close calls CloseFunc.

func (*BidiStreamMock) CloseCalls

func (mock *BidiStreamMock) CloseCalls() []struct {
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedBidiStream.CloseCalls())

func (*BidiStreamMock) Receive

func (mock *BidiStreamMock) Receive(res *proto.Message) error

Receive calls ReceiveFunc.

func (*BidiStreamMock) ReceiveCalls

func (mock *BidiStreamMock) ReceiveCalls() []struct {
	Res *proto.Message
}

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

len(mockedBidiStream.ReceiveCalls())

func (*BidiStreamMock) Send

func (mock *BidiStreamMock) Send(req proto.Message) error

Send calls SendFunc.

func (*BidiStreamMock) SendCalls

func (mock *BidiStreamMock) SendCalls() []struct {
	Req proto.Message
}

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

len(mockedBidiStream.SendCalls())

type ClientStreamMock

type ClientStreamMock struct {
	// CloseAndReceiveFunc mocks the CloseAndReceive method.
	CloseAndReceiveFunc func(res *proto.Message) error

	// SendFunc mocks the Send method.
	SendFunc func(req proto.Message) error
	// contains filtered or unexported fields
}

ClientStreamMock is a mock implementation of ClientStream.

    func TestSomethingThatUsesClientStream(t *testing.T) {

        // make and configure a mocked ClientStream
        mockedClientStream := &ClientStreamMock{
            CloseAndReceiveFunc: func(res *proto.Message) error {
	               panic("TODO: mock out the CloseAndReceive method")
            },
            SendFunc: func(req proto.Message) error {
	               panic("TODO: mock out the Send method")
            },
        }

        // TODO: use mockedClientStream in code that requires ClientStream
        //       and then make assertions.

    }

func (*ClientStreamMock) CloseAndReceive

func (mock *ClientStreamMock) CloseAndReceive(res *proto.Message) error

CloseAndReceive calls CloseAndReceiveFunc.

func (*ClientStreamMock) CloseAndReceiveCalls

func (mock *ClientStreamMock) CloseAndReceiveCalls() []struct {
	Res *proto.Message
}

CloseAndReceiveCalls gets all the calls that were made to CloseAndReceive. Check the length with:

len(mockedClientStream.CloseAndReceiveCalls())

func (*ClientStreamMock) Send

func (mock *ClientStreamMock) Send(req proto.Message) error

Send calls SendFunc.

func (*ClientStreamMock) SendCalls

func (mock *ClientStreamMock) SendCalls() []struct {
	Req proto.Message
}

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

len(mockedClientStream.SendCalls())

type FieldMock

type FieldMock struct {
	// FQRNFunc mocks the FQRN method.
	FQRNFunc func() string

	// FieldNameFunc mocks the FieldName method.
	FieldNameFunc func() string

	// IsRepeatedFunc mocks the IsRepeated method.
	IsRepeatedFunc func() bool

	// PBTypeFunc mocks the PBType method.
	PBTypeFunc func() string

	// TypeFunc mocks the Type method.
	TypeFunc func() entity.FieldType
	// contains filtered or unexported fields
}

FieldMock is a mock implementation of Field.

    func TestSomethingThatUsesField(t *testing.T) {

        // make and configure a mocked Field
        mockedField := &FieldMock{
            FQRNFunc: func() string {
	               panic("TODO: mock out the FQRN method")
            },
            FieldNameFunc: func() string {
	               panic("TODO: mock out the FieldName method")
            },
            IsRepeatedFunc: func() bool {
	               panic("TODO: mock out the IsRepeated method")
            },
            PBTypeFunc: func() string {
	               panic("TODO: mock out the PBType method")
            },
            TypeFunc: func() entity.FieldType {
	               panic("TODO: mock out the Type method")
            },
        }

        // TODO: use mockedField in code that requires Field
        //       and then make assertions.

    }

func (*FieldMock) FQRN

func (mock *FieldMock) FQRN() string

FQRN calls FQRNFunc.

func (*FieldMock) FQRNCalls

func (mock *FieldMock) FQRNCalls() []struct {
}

FQRNCalls gets all the calls that were made to FQRN. Check the length with:

len(mockedField.FQRNCalls())

func (*FieldMock) FieldName

func (mock *FieldMock) FieldName() string

FieldName calls FieldNameFunc.

func (*FieldMock) FieldNameCalls

func (mock *FieldMock) FieldNameCalls() []struct {
}

FieldNameCalls gets all the calls that were made to FieldName. Check the length with:

len(mockedField.FieldNameCalls())

func (*FieldMock) IsRepeated

func (mock *FieldMock) IsRepeated() bool

IsRepeated calls IsRepeatedFunc.

func (*FieldMock) IsRepeatedCalls

func (mock *FieldMock) IsRepeatedCalls() []struct {
}

IsRepeatedCalls gets all the calls that were made to IsRepeated. Check the length with:

len(mockedField.IsRepeatedCalls())

func (*FieldMock) PBType

func (mock *FieldMock) PBType() string

PBType calls PBTypeFunc.

func (*FieldMock) PBTypeCalls

func (mock *FieldMock) PBTypeCalls() []struct {
}

PBTypeCalls gets all the calls that were made to PBType. Check the length with:

len(mockedField.PBTypeCalls())

func (*FieldMock) Type

func (mock *FieldMock) Type() entity.FieldType

Type calls TypeFunc.

func (*FieldMock) TypeCalls

func (mock *FieldMock) TypeCalls() []struct {
}

TypeCalls gets all the calls that were made to Type. Check the length with:

len(mockedField.TypeCalls())

type GRPCClientMock

type GRPCClientMock struct {
	// CloseFunc mocks the Close method.
	CloseFunc func(ctx context.Context) error

	// InvokeFunc mocks the Invoke method.
	InvokeFunc func(ctx context.Context, fqrn string, req interface{}, res interface{}) error

	// ListServicesFunc mocks the ListPackages method.
	ListServicesFunc func() ([]*entity.Package, error)

	// NewBidiStreamFunc mocks the NewBidiStream method.
	NewBidiStreamFunc func(ctx context.Context, rpc entity.RPC) (entity.BidiStream, error)

	// NewClientStreamFunc mocks the NewClientStream method.
	NewClientStreamFunc func(ctx context.Context, rpc entity.RPC) (entity.ClientStream, error)

	// NewServerStreamFunc mocks the NewServerStream method.
	NewServerStreamFunc func(ctx context.Context, rpc entity.RPC) (entity.ServerStream, error)

	// ReflectionEnabledFunc mocks the ReflectionEnabled method.
	ReflectionEnabledFunc func() bool
	// contains filtered or unexported fields
}

GRPCClientMock is a mock implementation of GRPCClient.

    func TestSomethingThatUsesGRPCClient(t *testing.T) {

        // make and configure a mocked GRPCClient
        mockedGRPCClient := &GRPCClientMock{
            CloseFunc: func(ctx context.Context) error {
	               panic("TODO: mock out the Close method")
            },
            InvokeFunc: func(ctx context.Context, fqrn string, req interface{}, res interface{}) error {
	               panic("TODO: mock out the Invoke method")
            },
            ListServicesFunc: func() ([]entity.Service, []entity.Message, error) {
	               panic("TODO: mock out the ListPackages method")
            },
            NewBidiStreamFunc: func(ctx context.Context, rpc entity.RPC) (entity.BidiStream, error) {
	               panic("TODO: mock out the NewBidiStream method")
            },
            NewClientStreamFunc: func(ctx context.Context, rpc entity.RPC) (entity.ClientStream, error) {
	               panic("TODO: mock out the NewClientStream method")
            },
            NewServerStreamFunc: func(ctx context.Context, rpc entity.RPC) (entity.ServerStream, error) {
	               panic("TODO: mock out the NewServerStream method")
            },
            ReflectionEnabledFunc: func() bool {
	               panic("TODO: mock out the ReflectionEnabled method")
            },
        }

        // TODO: use mockedGRPCClient in code that requires GRPCClient
        //       and then make assertions.

    }

func (*GRPCClientMock) Close

func (mock *GRPCClientMock) Close(ctx context.Context) error

Close calls CloseFunc.

func (*GRPCClientMock) CloseCalls

func (mock *GRPCClientMock) CloseCalls() []struct {
	Ctx context.Context
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedGRPCClient.CloseCalls())

func (*GRPCClientMock) Invoke

func (mock *GRPCClientMock) Invoke(ctx context.Context, fqrn string, req interface{}, res interface{}) error

Invoke calls InvokeFunc.

func (*GRPCClientMock) InvokeCalls

func (mock *GRPCClientMock) InvokeCalls() []struct {
	Ctx  context.Context
	Fqrn string
	Req  interface{}
	Res  interface{}
}

InvokeCalls gets all the calls that were made to Invoke. Check the length with:

len(mockedGRPCClient.InvokeCalls())

func (*GRPCClientMock) ListPackages added in v0.7.1

func (mock *GRPCClientMock) ListPackages() ([]*entity.Package, error)

ListPackages calls ListServicesFunc.

func (*GRPCClientMock) ListServicesCalls

func (mock *GRPCClientMock) ListServicesCalls() []struct {
}

ListServicesCalls gets all the calls that were made to ListPackages. Check the length with:

len(mockedGRPCClient.ListServicesCalls())

func (*GRPCClientMock) NewBidiStream

func (mock *GRPCClientMock) NewBidiStream(ctx context.Context, rpc entity.RPC) (entity.BidiStream, error)

NewBidiStream calls NewBidiStreamFunc.

func (*GRPCClientMock) NewBidiStreamCalls

func (mock *GRPCClientMock) NewBidiStreamCalls() []struct {
	Ctx context.Context
	RPC entity.RPC
}

NewBidiStreamCalls gets all the calls that were made to NewBidiStream. Check the length with:

len(mockedGRPCClient.NewBidiStreamCalls())

func (*GRPCClientMock) NewClientStream

func (mock *GRPCClientMock) NewClientStream(ctx context.Context, rpc entity.RPC) (entity.ClientStream, error)

NewClientStream calls NewClientStreamFunc.

func (*GRPCClientMock) NewClientStreamCalls

func (mock *GRPCClientMock) NewClientStreamCalls() []struct {
	Ctx context.Context
	RPC entity.RPC
}

NewClientStreamCalls gets all the calls that were made to NewClientStream. Check the length with:

len(mockedGRPCClient.NewClientStreamCalls())

func (*GRPCClientMock) NewServerStream

func (mock *GRPCClientMock) NewServerStream(ctx context.Context, rpc entity.RPC) (entity.ServerStream, error)

NewServerStream calls NewServerStreamFunc.

func (*GRPCClientMock) NewServerStreamCalls

func (mock *GRPCClientMock) NewServerStreamCalls() []struct {
	Ctx context.Context
	RPC entity.RPC
}

NewServerStreamCalls gets all the calls that were made to NewServerStream. Check the length with:

len(mockedGRPCClient.NewServerStreamCalls())

func (*GRPCClientMock) ReflectionEnabled

func (mock *GRPCClientMock) ReflectionEnabled() bool

ReflectionEnabled calls ReflectionEnabledFunc.

func (*GRPCClientMock) ReflectionEnabledCalls

func (mock *GRPCClientMock) ReflectionEnabledCalls() []struct {
}

ReflectionEnabledCalls gets all the calls that were made to ReflectionEnabled. Check the length with:

len(mockedGRPCClient.ReflectionEnabledCalls())

type MessageMock

type MessageMock struct {
	// FieldsFunc mocks the Fields method.
	FieldsFunc func() []entity.Field

	// IsCycledFunc mocks the IsCycled method.
	IsCycledFunc func() bool

	// NameFunc mocks the Name method.
	NameFunc func() string
	// contains filtered or unexported fields
}

MessageMock is a mock implementation of Message.

    func TestSomethingThatUsesMessage(t *testing.T) {

        // make and configure a mocked Message
        mockedMessage := &MessageMock{
            FieldsFunc: func() []entity.Field {
	               panic("TODO: mock out the Fields method")
            },
            IsCycledFunc: func() bool {
	               panic("TODO: mock out the IsCycled method")
            },
            NameFunc: func() string {
	               panic("TODO: mock out the Name method")
            },
        }

        // TODO: use mockedMessage in code that requires Message
        //       and then make assertions.

    }

func (*MessageMock) Fields

func (mock *MessageMock) Fields() []entity.Field

Fields calls FieldsFunc.

func (*MessageMock) FieldsCalls

func (mock *MessageMock) FieldsCalls() []struct {
}

FieldsCalls gets all the calls that were made to Fields. Check the length with:

len(mockedMessage.FieldsCalls())

func (*MessageMock) IsCycled

func (mock *MessageMock) IsCycled() bool

IsCycled calls IsCycledFunc.

func (*MessageMock) IsCycledCalls

func (mock *MessageMock) IsCycledCalls() []struct {
}

IsCycledCalls gets all the calls that were made to IsCycled. Check the length with:

len(mockedMessage.IsCycledCalls())

func (*MessageMock) Name

func (mock *MessageMock) Name() string

Name calls NameFunc.

func (*MessageMock) NameCalls

func (mock *MessageMock) NameCalls() []struct {
}

NameCalls gets all the calls that were made to Name. Check the length with:

len(mockedMessage.NameCalls())

type RPCMock

type RPCMock struct {
	// FQRNFunc mocks the FQRN method.
	FQRNFunc func() string

	// IsClientStreamingFunc mocks the IsClientStreaming method.
	IsClientStreamingFunc func() bool

	// IsServerStreamingFunc mocks the IsServerStreaming method.
	IsServerStreamingFunc func() bool

	// NameFunc mocks the Name method.
	NameFunc func() string

	// RequestMessageFunc mocks the RequestMessage method.
	RequestMessageFunc func() entity.Message

	// ResponseMessageFunc mocks the ResponseMessage method.
	ResponseMessageFunc func() entity.Message

	// StreamDescFunc mocks the StreamDesc method.
	StreamDescFunc func() *grpc.StreamDesc
	// contains filtered or unexported fields
}

RPCMock is a mock implementation of RPC.

    func TestSomethingThatUsesRPC(t *testing.T) {

        // make and configure a mocked RPC
        mockedRPC := &RPCMock{
            FQRNFunc: func() string {
	               panic("TODO: mock out the FQRN method")
            },
            IsClientStreamingFunc: func() bool {
	               panic("TODO: mock out the IsClientStreaming method")
            },
            IsServerStreamingFunc: func() bool {
	               panic("TODO: mock out the IsServerStreaming method")
            },
            NameFunc: func() string {
	               panic("TODO: mock out the Name method")
            },
            RequestMessageFunc: func() entity.Message {
	               panic("TODO: mock out the RequestMessage method")
            },
            ResponseMessageFunc: func() entity.Message {
	               panic("TODO: mock out the ResponseMessage method")
            },
            StreamDescFunc: func() *grpc.StreamDesc {
	               panic("TODO: mock out the StreamDesc method")
            },
        }

        // TODO: use mockedRPC in code that requires RPC
        //       and then make assertions.

    }

func (*RPCMock) FQRN

func (mock *RPCMock) FQRN() string

FQRN calls FQRNFunc.

func (*RPCMock) FQRNCalls

func (mock *RPCMock) FQRNCalls() []struct {
}

FQRNCalls gets all the calls that were made to FQRN. Check the length with:

len(mockedRPC.FQRNCalls())

func (*RPCMock) IsClientStreaming

func (mock *RPCMock) IsClientStreaming() bool

IsClientStreaming calls IsClientStreamingFunc.

func (*RPCMock) IsClientStreamingCalls

func (mock *RPCMock) IsClientStreamingCalls() []struct {
}

IsClientStreamingCalls gets all the calls that were made to IsClientStreaming. Check the length with:

len(mockedRPC.IsClientStreamingCalls())

func (*RPCMock) IsServerStreaming

func (mock *RPCMock) IsServerStreaming() bool

IsServerStreaming calls IsServerStreamingFunc.

func (*RPCMock) IsServerStreamingCalls

func (mock *RPCMock) IsServerStreamingCalls() []struct {
}

IsServerStreamingCalls gets all the calls that were made to IsServerStreaming. Check the length with:

len(mockedRPC.IsServerStreamingCalls())

func (*RPCMock) Name

func (mock *RPCMock) Name() string

Name calls NameFunc.

func (*RPCMock) NameCalls

func (mock *RPCMock) NameCalls() []struct {
}

NameCalls gets all the calls that were made to Name. Check the length with:

len(mockedRPC.NameCalls())

func (*RPCMock) RequestMessage

func (mock *RPCMock) RequestMessage() entity.Message

RequestMessage calls RequestMessageFunc.

func (*RPCMock) RequestMessageCalls

func (mock *RPCMock) RequestMessageCalls() []struct {
}

RequestMessageCalls gets all the calls that were made to RequestMessage. Check the length with:

len(mockedRPC.RequestMessageCalls())

func (*RPCMock) ResponseMessage

func (mock *RPCMock) ResponseMessage() entity.Message

ResponseMessage calls ResponseMessageFunc.

func (*RPCMock) ResponseMessageCalls

func (mock *RPCMock) ResponseMessageCalls() []struct {
}

ResponseMessageCalls gets all the calls that were made to ResponseMessage. Check the length with:

len(mockedRPC.ResponseMessageCalls())

func (*RPCMock) StreamDesc

func (mock *RPCMock) StreamDesc() *grpc.StreamDesc

StreamDesc calls StreamDescFunc.

func (*RPCMock) StreamDescCalls

func (mock *RPCMock) StreamDescCalls() []struct {
}

StreamDescCalls gets all the calls that were made to StreamDesc. Check the length with:

len(mockedRPC.StreamDescCalls())

type ServerStreamMock

type ServerStreamMock struct {
	// ReceiveFunc mocks the Receive method.
	ReceiveFunc func(res *proto.Message) error

	// SendFunc mocks the Send method.
	SendFunc func(req proto.Message) error
	// contains filtered or unexported fields
}

ServerStreamMock is a mock implementation of ServerStream.

    func TestSomethingThatUsesServerStream(t *testing.T) {

        // make and configure a mocked ServerStream
        mockedServerStream := &ServerStreamMock{
            ReceiveFunc: func(res *proto.Message) error {
	               panic("TODO: mock out the Receive method")
            },
            SendFunc: func(req proto.Message) error {
	               panic("TODO: mock out the Send method")
            },
        }

        // TODO: use mockedServerStream in code that requires ServerStream
        //       and then make assertions.

    }

func (*ServerStreamMock) Receive

func (mock *ServerStreamMock) Receive(res *proto.Message) error

Receive calls ReceiveFunc.

func (*ServerStreamMock) ReceiveCalls

func (mock *ServerStreamMock) ReceiveCalls() []struct {
	Res *proto.Message
}

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

len(mockedServerStream.ReceiveCalls())

func (*ServerStreamMock) Send

func (mock *ServerStreamMock) Send(req proto.Message) error

Send calls SendFunc.

func (*ServerStreamMock) SendCalls

func (mock *ServerStreamMock) SendCalls() []struct {
	Req proto.Message
}

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

len(mockedServerStream.SendCalls())

type ServiceMock

type ServiceMock struct {
	// FQRNFunc mocks the FQRN method.
	FQRNFunc func() string

	// NameFunc mocks the Name method.
	NameFunc func() string

	// RPCsFunc mocks the RPCs method.
	RPCsFunc func() []entity.RPC
	// contains filtered or unexported fields
}

ServiceMock is a mock implementation of Service.

    func TestSomethingThatUsesService(t *testing.T) {

        // make and configure a mocked Service
        mockedService := &ServiceMock{
            FQRNFunc: func() string {
	               panic("TODO: mock out the FQRN method")
            },
            NameFunc: func() string {
	               panic("TODO: mock out the Name method")
            },
            RPCsFunc: func() []entity.RPC {
	               panic("TODO: mock out the RPCs method")
            },
        }

        // TODO: use mockedService in code that requires Service
        //       and then make assertions.

    }

func (*ServiceMock) FQRN

func (mock *ServiceMock) FQRN() string

FQRN calls FQRNFunc.

func (*ServiceMock) FQRNCalls

func (mock *ServiceMock) FQRNCalls() []struct {
}

FQRNCalls gets all the calls that were made to FQRN. Check the length with:

len(mockedService.FQRNCalls())

func (*ServiceMock) Name

func (mock *ServiceMock) Name() string

Name calls NameFunc.

func (*ServiceMock) NameCalls

func (mock *ServiceMock) NameCalls() []struct {
}

NameCalls gets all the calls that were made to Name. Check the length with:

len(mockedService.NameCalls())

func (*ServiceMock) RPCs

func (mock *ServiceMock) RPCs() []entity.RPC

RPCs calls RPCsFunc.

func (*ServiceMock) RPCsCalls

func (mock *ServiceMock) RPCsCalls() []struct {
}

RPCsCalls gets all the calls that were made to RPCs. Check the length with:

len(mockedService.RPCsCalls())

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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