mock

package
v0.0.0-...-8b7d7e7 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any

func Any() func(t *testing.T, a interface{})

mock.Any() can be used in recording to not check for the argument

func ErrorOrNil

func ErrorOrNil(err interface{}) error

Helper method to cast to an error if given

Types

type ApiMethodCall

type ApiMethodCall struct {
	Args   []interface{}
	Result []interface{}
}

Recorded method call

type Recorder

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

Recorder for recording mock call

func NewRecorder

func NewRecorder(t *testing.T, namespace string) *Recorder

func (*Recorder) Add

func (r *Recorder) Add(name string, args []interface{}, result []interface{})

Add a recorded api call the list of calls

func (*Recorder) CheckThatAllRecordedMethodsHaveBeenCalled

func (r *Recorder) CheckThatAllRecordedMethodsHaveBeenCalled()

Check if every method has been called

func (*Recorder) Namespace

func (r *Recorder) Namespace() string

func (*Recorder) Shift

func (r *Recorder) Shift(name string) (*ApiMethodCall, error)

Get the next recorded call

func (*Recorder) VerifyCall

func (r *Recorder) VerifyCall(name string, args ...interface{}) *ApiMethodCall

Verify given arguments against recorded arguments

Jump to

Keyboard shortcuts

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