mock

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KVQueueMock

type KVQueueMock struct {
	// DequeueFunc mocks the Dequeue method.
	DequeueFunc func(value codec.ProtoMarshaler) bool

	// DequeueIfFunc mocks the DequeueIf method.
	DequeueIfFunc func(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool

	// DequeueUntilFunc mocks the DequeueUntil method.
	DequeueUntilFunc func(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool

	// EnqueueFunc mocks the Enqueue method.
	EnqueueFunc func(key utils.Key, value codec.ProtoMarshaler)

	// IsEmptyFunc mocks the IsEmpty method.
	IsEmptyFunc func() bool

	// KeysFunc mocks the Keys method.
	KeysFunc func() []utils.Key
	// contains filtered or unexported fields
}

KVQueueMock is a mock implementation of utils.KVQueue.

func TestSomethingThatUsesKVQueue(t *testing.T) {

	// make and configure a mocked utils.KVQueue
	mockedKVQueue := &KVQueueMock{
		DequeueFunc: func(value codec.ProtoMarshaler) bool {
			panic("mock out the Dequeue method")
		},
		DequeueIfFunc: func(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool {
			panic("mock out the DequeueIf method")
		},
		DequeueUntilFunc: func(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool {
			panic("mock out the DequeueUntil method")
		},
		EnqueueFunc: func(key utils.Key, value codec.ProtoMarshaler)  {
			panic("mock out the Enqueue method")
		},
		IsEmptyFunc: func() bool {
			panic("mock out the IsEmpty method")
		},
		KeysFunc: func() []utils.Key {
			panic("mock out the Keys method")
		},
	}

	// use mockedKVQueue in code that requires utils.KVQueue
	// and then make assertions.

}

func (*KVQueueMock) Dequeue

func (mock *KVQueueMock) Dequeue(value codec.ProtoMarshaler) bool

Dequeue calls DequeueFunc.

func (*KVQueueMock) DequeueCalls

func (mock *KVQueueMock) DequeueCalls() []struct {
	Value codec.ProtoMarshaler
}

DequeueCalls gets all the calls that were made to Dequeue. Check the length with:

len(mockedKVQueue.DequeueCalls())

func (*KVQueueMock) DequeueIf added in v0.21.0

func (mock *KVQueueMock) DequeueIf(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool

DequeueIf calls DequeueIfFunc.

func (*KVQueueMock) DequeueIfCalls added in v0.21.0

func (mock *KVQueueMock) DequeueIfCalls() []struct {
	Value  codec.ProtoMarshaler
	Filter func(value codec.ProtoMarshaler) bool
}

DequeueIfCalls gets all the calls that were made to DequeueIf. Check the length with:

len(mockedKVQueue.DequeueIfCalls())

func (*KVQueueMock) DequeueUntil added in v0.21.0

func (mock *KVQueueMock) DequeueUntil(value codec.ProtoMarshaler, filter func(value codec.ProtoMarshaler) bool) bool

DequeueUntil calls DequeueUntilFunc.

func (*KVQueueMock) DequeueUntilCalls added in v0.21.0

func (mock *KVQueueMock) DequeueUntilCalls() []struct {
	Value  codec.ProtoMarshaler
	Filter func(value codec.ProtoMarshaler) bool
}

DequeueUntilCalls gets all the calls that were made to DequeueUntil. Check the length with:

len(mockedKVQueue.DequeueUntilCalls())

func (*KVQueueMock) Enqueue

func (mock *KVQueueMock) Enqueue(key utils.Key, value codec.ProtoMarshaler)

Enqueue calls EnqueueFunc.

func (*KVQueueMock) EnqueueCalls

func (mock *KVQueueMock) EnqueueCalls() []struct {
	Key   utils.Key
	Value codec.ProtoMarshaler
}

EnqueueCalls gets all the calls that were made to Enqueue. Check the length with:

len(mockedKVQueue.EnqueueCalls())

func (*KVQueueMock) IsEmpty

func (mock *KVQueueMock) IsEmpty() bool

IsEmpty calls IsEmptyFunc.

func (*KVQueueMock) IsEmptyCalls

func (mock *KVQueueMock) IsEmptyCalls() []struct {
}

IsEmptyCalls gets all the calls that were made to IsEmpty. Check the length with:

len(mockedKVQueue.IsEmptyCalls())

func (*KVQueueMock) Keys added in v0.10.0

func (mock *KVQueueMock) Keys() []utils.Key

Keys calls KeysFunc.

func (*KVQueueMock) KeysCalls added in v0.10.0

func (mock *KVQueueMock) KeysCalls() []struct {
}

KeysCalls gets all the calls that were made to Keys. Check the length with:

len(mockedKVQueue.KeysCalls())

type LoggerMock added in v0.17.0

type LoggerMock struct {
	// LoggerFunc mocks the Logger method.
	LoggerFunc func(ctx sdk.Context) log.Logger
	// contains filtered or unexported fields
}

LoggerMock is a mock implementation of utils.Logger.

func TestSomethingThatUsesLogger(t *testing.T) {

	// make and configure a mocked utils.Logger
	mockedLogger := &LoggerMock{
		LoggerFunc: func(ctx sdk.Context) log.Logger {
			panic("mock out the Logger method")
		},
	}

	// use mockedLogger in code that requires utils.Logger
	// and then make assertions.

}

func (*LoggerMock) Logger added in v0.17.0

func (mock *LoggerMock) Logger(ctx sdk.Context) log.Logger

Logger calls LoggerFunc.

func (*LoggerMock) LoggerCalls added in v0.17.0

func (mock *LoggerMock) LoggerCalls() []struct {
	Ctx sdk.Context
}

LoggerCalls gets all the calls that were made to Logger. Check the length with:

len(mockedLogger.LoggerCalls())

type ValidatedProtoMarshalerMock added in v0.27.0

type ValidatedProtoMarshalerMock struct {
	// MarshalFunc mocks the Marshal method.
	MarshalFunc func() ([]byte, error)

	// MarshalToFunc mocks the MarshalTo method.
	MarshalToFunc func(data []byte) (int, error)

	// MarshalToSizedBufferFunc mocks the MarshalToSizedBuffer method.
	MarshalToSizedBufferFunc func(dAtA []byte) (int, error)

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

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

	// SizeFunc mocks the Size method.
	SizeFunc func() int

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

	// UnmarshalFunc mocks the Unmarshal method.
	UnmarshalFunc func(data []byte) error

	// ValidateBasicFunc mocks the ValidateBasic method.
	ValidateBasicFunc func() error
	// contains filtered or unexported fields
}

ValidatedProtoMarshalerMock is a mock implementation of utils.ValidatedProtoMarshaler.

func TestSomethingThatUsesValidatedProtoMarshaler(t *testing.T) {

	// make and configure a mocked utils.ValidatedProtoMarshaler
	mockedValidatedProtoMarshaler := &ValidatedProtoMarshalerMock{
		MarshalFunc: func() ([]byte, error) {
			panic("mock out the Marshal method")
		},
		MarshalToFunc: func(data []byte) (int, error) {
			panic("mock out the MarshalTo method")
		},
		MarshalToSizedBufferFunc: func(dAtA []byte) (int, error) {
			panic("mock out the MarshalToSizedBuffer method")
		},
		ProtoMessageFunc: func()  {
			panic("mock out the ProtoMessage method")
		},
		ResetFunc: func()  {
			panic("mock out the Reset method")
		},
		SizeFunc: func() int {
			panic("mock out the Size method")
		},
		StringFunc: func() string {
			panic("mock out the String method")
		},
		UnmarshalFunc: func(data []byte) error {
			panic("mock out the Unmarshal method")
		},
		ValidateBasicFunc: func() error {
			panic("mock out the ValidateBasic method")
		},
	}

	// use mockedValidatedProtoMarshaler in code that requires utils.ValidatedProtoMarshaler
	// and then make assertions.

}

func (*ValidatedProtoMarshalerMock) Marshal added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) Marshal() ([]byte, error)

Marshal calls MarshalFunc.

func (*ValidatedProtoMarshalerMock) MarshalCalls added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) MarshalCalls() []struct {
}

MarshalCalls gets all the calls that were made to Marshal. Check the length with:

len(mockedValidatedProtoMarshaler.MarshalCalls())

func (*ValidatedProtoMarshalerMock) MarshalTo added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) MarshalTo(data []byte) (int, error)

MarshalTo calls MarshalToFunc.

func (*ValidatedProtoMarshalerMock) MarshalToCalls added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) MarshalToCalls() []struct {
	Data []byte
}

MarshalToCalls gets all the calls that were made to MarshalTo. Check the length with:

len(mockedValidatedProtoMarshaler.MarshalToCalls())

func (*ValidatedProtoMarshalerMock) MarshalToSizedBuffer added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) MarshalToSizedBuffer(dAtA []byte) (int, error)

MarshalToSizedBuffer calls MarshalToSizedBufferFunc.

func (*ValidatedProtoMarshalerMock) MarshalToSizedBufferCalls added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) MarshalToSizedBufferCalls() []struct {
	DAtA []byte
}

MarshalToSizedBufferCalls gets all the calls that were made to MarshalToSizedBuffer. Check the length with:

len(mockedValidatedProtoMarshaler.MarshalToSizedBufferCalls())

func (*ValidatedProtoMarshalerMock) ProtoMessage added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) ProtoMessage()

ProtoMessage calls ProtoMessageFunc.

func (*ValidatedProtoMarshalerMock) ProtoMessageCalls added in v0.27.0

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

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

len(mockedValidatedProtoMarshaler.ProtoMessageCalls())

func (*ValidatedProtoMarshalerMock) Reset added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) Reset()

Reset calls ResetFunc.

func (*ValidatedProtoMarshalerMock) ResetCalls added in v0.27.0

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

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

len(mockedValidatedProtoMarshaler.ResetCalls())

func (*ValidatedProtoMarshalerMock) Size added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) Size() int

Size calls SizeFunc.

func (*ValidatedProtoMarshalerMock) SizeCalls added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) SizeCalls() []struct {
}

SizeCalls gets all the calls that were made to Size. Check the length with:

len(mockedValidatedProtoMarshaler.SizeCalls())

func (*ValidatedProtoMarshalerMock) String added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) String() string

String calls StringFunc.

func (*ValidatedProtoMarshalerMock) StringCalls added in v0.27.0

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

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

len(mockedValidatedProtoMarshaler.StringCalls())

func (*ValidatedProtoMarshalerMock) Unmarshal added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) Unmarshal(data []byte) error

Unmarshal calls UnmarshalFunc.

func (*ValidatedProtoMarshalerMock) UnmarshalCalls added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) UnmarshalCalls() []struct {
	Data []byte
}

UnmarshalCalls gets all the calls that were made to Unmarshal. Check the length with:

len(mockedValidatedProtoMarshaler.UnmarshalCalls())

func (*ValidatedProtoMarshalerMock) ValidateBasic added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) ValidateBasic() error

ValidateBasic calls ValidateBasicFunc.

func (*ValidatedProtoMarshalerMock) ValidateBasicCalls added in v0.27.0

func (mock *ValidatedProtoMarshalerMock) ValidateBasicCalls() []struct {
}

ValidateBasicCalls gets all the calls that were made to ValidateBasic. Check the length with:

len(mockedValidatedProtoMarshaler.ValidateBasicCalls())

Jump to

Keyboard shortcuts

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