mocking

package
v0.0.0-...-80164ef Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoError = "no_error_mock_result"
)

Variables

View Source
var (
	ErrAssertMockResult     = errors.New("an error occurred at asserting mock result")
	ErrCannotCastResult     = errors.New("cannot cast expected mock result")
	ErrImplementMe          = errors.New("unknown returnFor in mock. Need some result")
	ErrIllegalResultForMock = errors.New("illegal result for a mocked method")
)
View Source
var Modes = ModeEnum{
	// contains filtered or unexported fields
}
View Source
var (
	UnsupportedModeErrorCode = errors.ErrorCode("af6cbd01-001")
)

Functions

func ErrUnsupportedMode

func ErrUnsupportedMode(modeStr string) error

Types

type BaseMock

type BaseMock struct {
	// contains filtered or unexported fields
}

func NewBaseMock

func NewBaseMock(mode Mode) *BaseMock

func (*BaseMock) GetCalledArgs

func (m *BaseMock) GetCalledArgs(method string) []interface{}

func (*BaseMock) GetCountCallsFor

func (m *BaseMock) GetCountCallsFor(method string) uint

func (*BaseMock) IsMethodCalled

func (m *BaseMock) IsMethodCalled(method string) bool

func (*BaseMock) IsNeverCalled

func (m *BaseMock) IsNeverCalled() bool

func (*BaseMock) ProcessMethod

func (m *BaseMock) ProcessMethod(args ...interface{}) (interface{}, error)

func (*BaseMock) Reset

func (m *BaseMock) Reset()

func (*BaseMock) SetReturnsFor

func (m *BaseMock) SetReturnsFor(methodName string, mockValue interface{})

type InvokeFunc

type InvokeFunc func(args ...interface{}) error

type Mode

type Mode string

func (Mode) String

func (m Mode) String() string

type ModeEnum

type ModeEnum map[string]Mode

func (ModeEnum) Base

func (e ModeEnum) Base() Mode

func (ModeEnum) Of

func (e ModeEnum) Of(modeStr string) (Mode, error)

func (ModeEnum) Strict

func (e ModeEnum) Strict() Mode

Jump to

Keyboard shortcuts

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