mocks

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockServiceContainer

type MockServiceContainer struct {
	// GetFunc is an instance of a mock function object controlling the
	// behavior of the method Get.
	GetFunc *ServiceContainerGetFunc
	// InjectFunc is an instance of a mock function object controlling the
	// behavior of the method Inject.
	InjectFunc *ServiceContainerInjectFunc
	// MustGetFunc is an instance of a mock function object controlling the
	// behavior of the method MustGet.
	MustGetFunc *ServiceContainerMustGetFunc
	// MustSetFunc is an instance of a mock function object controlling the
	// behavior of the method MustSet.
	MustSetFunc *ServiceContainerMustSetFunc
	// SetFunc is an instance of a mock function object controlling the
	// behavior of the method Set.
	SetFunc *ServiceContainerSetFunc
}

MockServiceContainer is a mock implementation of the ServiceContainer interface (from the package github.com/go-nacelle/service) used for unit testing.

func NewMockServiceContainer

func NewMockServiceContainer() *MockServiceContainer

NewMockServiceContainer creates a new mock of the ServiceContainer interface. All methods return zero values for all results, unless overwritten.

func NewMockServiceContainerFrom

func NewMockServiceContainerFrom(i service.ServiceContainer) *MockServiceContainer

NewMockServiceContainerFrom creates a new mock of the MockServiceContainer interface. All methods delegate to the given implementation, unless overwritten.

func (*MockServiceContainer) Get

func (m *MockServiceContainer) Get(v0 string) (interface{}, error)

Get delegates to the next hook function in the queue and stores the parameter and result values of this invocation.

func (*MockServiceContainer) Inject

func (m *MockServiceContainer) Inject(v0 interface{}) error

Inject delegates to the next hook function in the queue and stores the parameter and result values of this invocation.

func (*MockServiceContainer) MustGet

func (m *MockServiceContainer) MustGet(v0 string) interface{}

MustGet delegates to the next hook function in the queue and stores the parameter and result values of this invocation.

func (*MockServiceContainer) MustSet

func (m *MockServiceContainer) MustSet(v0 string, v1 interface{})

MustSet delegates to the next hook function in the queue and stores the parameter and result values of this invocation.

func (*MockServiceContainer) Set

func (m *MockServiceContainer) Set(v0 string, v1 interface{}) error

Set delegates to the next hook function in the queue and stores the parameter and result values of this invocation.

type ServiceContainerGetFunc

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

ServiceContainerGetFunc describes the behavior when the Get method of the parent MockServiceContainer instance is invoked.

func (*ServiceContainerGetFunc) History

History returns a sequence of ServiceContainerGetFuncCall objects describing the invocations of this function.

func (*ServiceContainerGetFunc) PushHook

func (f *ServiceContainerGetFunc) PushHook(hook func(string) (interface{}, error))

PushHook adds a function to the end of hook queue. Each invocation of the Get method of the parent MockServiceContainer instance invokes the hook at the front of the queue and discards it. After the queue is empty, the default hook function is invoked for any future action.

func (*ServiceContainerGetFunc) PushReturn

func (f *ServiceContainerGetFunc) PushReturn(r0 interface{}, r1 error)

PushReturn calls PushDefaultHook with a function that returns the given values.

func (*ServiceContainerGetFunc) SetDefaultHook

func (f *ServiceContainerGetFunc) SetDefaultHook(hook func(string) (interface{}, error))

SetDefaultHook sets function that is called when the Get method of the parent MockServiceContainer instance is invoked and the hook queue is empty.

func (*ServiceContainerGetFunc) SetDefaultReturn

func (f *ServiceContainerGetFunc) SetDefaultReturn(r0 interface{}, r1 error)

SetDefaultReturn calls SetDefaultDefaultHook with a function that returns the given values.

type ServiceContainerGetFuncCall

type ServiceContainerGetFuncCall struct {
	// Arg0 is the value of the 1st argument passed to this method
	// invocation.
	Arg0 string
	// Result0 is the value of the 1st result returned from this method
	// invocation.
	Result0 interface{}
	// Result1 is the value of the 2nd result returned from this method
	// invocation.
	Result1 error
}

ServiceContainerGetFuncCall is an object that describes an invocation of method Get on an instance of MockServiceContainer.

func (ServiceContainerGetFuncCall) Args

func (c ServiceContainerGetFuncCall) Args() []interface{}

Args returns an interface slice containing the arguments of this invocation.

func (ServiceContainerGetFuncCall) Results

func (c ServiceContainerGetFuncCall) Results() []interface{}

Results returns an interface slice containing the results of this invocation.

type ServiceContainerInjectFunc

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

ServiceContainerInjectFunc describes the behavior when the Inject method of the parent MockServiceContainer instance is invoked.

func (*ServiceContainerInjectFunc) History

History returns a sequence of ServiceContainerInjectFuncCall objects describing the invocations of this function.

func (*ServiceContainerInjectFunc) PushHook

func (f *ServiceContainerInjectFunc) PushHook(hook func(interface{}) error)

PushHook adds a function to the end of hook queue. Each invocation of the Inject method of the parent MockServiceContainer instance invokes the hook at the front of the queue and discards it. After the queue is empty, the default hook function is invoked for any future action.

func (*ServiceContainerInjectFunc) PushReturn

func (f *ServiceContainerInjectFunc) PushReturn(r0 error)

PushReturn calls PushDefaultHook with a function that returns the given values.

func (*ServiceContainerInjectFunc) SetDefaultHook

func (f *ServiceContainerInjectFunc) SetDefaultHook(hook func(interface{}) error)

SetDefaultHook sets function that is called when the Inject method of the parent MockServiceContainer instance is invoked and the hook queue is empty.

func (*ServiceContainerInjectFunc) SetDefaultReturn

func (f *ServiceContainerInjectFunc) SetDefaultReturn(r0 error)

SetDefaultReturn calls SetDefaultDefaultHook with a function that returns the given values.

type ServiceContainerInjectFuncCall

type ServiceContainerInjectFuncCall struct {
	// Arg0 is the value of the 1st argument passed to this method
	// invocation.
	Arg0 interface{}
	// Result0 is the value of the 1st result returned from this method
	// invocation.
	Result0 error
}

ServiceContainerInjectFuncCall is an object that describes an invocation of method Inject on an instance of MockServiceContainer.

func (ServiceContainerInjectFuncCall) Args

func (c ServiceContainerInjectFuncCall) Args() []interface{}

Args returns an interface slice containing the arguments of this invocation.

func (ServiceContainerInjectFuncCall) Results

func (c ServiceContainerInjectFuncCall) Results() []interface{}

Results returns an interface slice containing the results of this invocation.

type ServiceContainerMustGetFunc

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

ServiceContainerMustGetFunc describes the behavior when the MustGet method of the parent MockServiceContainer instance is invoked.

func (*ServiceContainerMustGetFunc) History

History returns a sequence of ServiceContainerMustGetFuncCall objects describing the invocations of this function.

func (*ServiceContainerMustGetFunc) PushHook

func (f *ServiceContainerMustGetFunc) PushHook(hook func(string) interface{})

PushHook adds a function to the end of hook queue. Each invocation of the MustGet method of the parent MockServiceContainer instance invokes the hook at the front of the queue and discards it. After the queue is empty, the default hook function is invoked for any future action.

func (*ServiceContainerMustGetFunc) PushReturn

func (f *ServiceContainerMustGetFunc) PushReturn(r0 interface{})

PushReturn calls PushDefaultHook with a function that returns the given values.

func (*ServiceContainerMustGetFunc) SetDefaultHook

func (f *ServiceContainerMustGetFunc) SetDefaultHook(hook func(string) interface{})

SetDefaultHook sets function that is called when the MustGet method of the parent MockServiceContainer instance is invoked and the hook queue is empty.

func (*ServiceContainerMustGetFunc) SetDefaultReturn

func (f *ServiceContainerMustGetFunc) SetDefaultReturn(r0 interface{})

SetDefaultReturn calls SetDefaultDefaultHook with a function that returns the given values.

type ServiceContainerMustGetFuncCall

type ServiceContainerMustGetFuncCall struct {
	// Arg0 is the value of the 1st argument passed to this method
	// invocation.
	Arg0 string
	// Result0 is the value of the 1st result returned from this method
	// invocation.
	Result0 interface{}
}

ServiceContainerMustGetFuncCall is an object that describes an invocation of method MustGet on an instance of MockServiceContainer.

func (ServiceContainerMustGetFuncCall) Args

func (c ServiceContainerMustGetFuncCall) Args() []interface{}

Args returns an interface slice containing the arguments of this invocation.

func (ServiceContainerMustGetFuncCall) Results

func (c ServiceContainerMustGetFuncCall) Results() []interface{}

Results returns an interface slice containing the results of this invocation.

type ServiceContainerMustSetFunc

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

ServiceContainerMustSetFunc describes the behavior when the MustSet method of the parent MockServiceContainer instance is invoked.

func (*ServiceContainerMustSetFunc) History

History returns a sequence of ServiceContainerMustSetFuncCall objects describing the invocations of this function.

func (*ServiceContainerMustSetFunc) PushHook

func (f *ServiceContainerMustSetFunc) PushHook(hook func(string, interface{}))

PushHook adds a function to the end of hook queue. Each invocation of the MustSet method of the parent MockServiceContainer instance invokes the hook at the front of the queue and discards it. After the queue is empty, the default hook function is invoked for any future action.

func (*ServiceContainerMustSetFunc) PushReturn

func (f *ServiceContainerMustSetFunc) PushReturn()

PushReturn calls PushDefaultHook with a function that returns the given values.

func (*ServiceContainerMustSetFunc) SetDefaultHook

func (f *ServiceContainerMustSetFunc) SetDefaultHook(hook func(string, interface{}))

SetDefaultHook sets function that is called when the MustSet method of the parent MockServiceContainer instance is invoked and the hook queue is empty.

func (*ServiceContainerMustSetFunc) SetDefaultReturn

func (f *ServiceContainerMustSetFunc) SetDefaultReturn()

SetDefaultReturn calls SetDefaultDefaultHook with a function that returns the given values.

type ServiceContainerMustSetFuncCall

type ServiceContainerMustSetFuncCall struct {
	// Arg0 is the value of the 1st argument passed to this method
	// invocation.
	Arg0 string
	// Arg1 is the value of the 2nd argument passed to this method
	// invocation.
	Arg1 interface{}
}

ServiceContainerMustSetFuncCall is an object that describes an invocation of method MustSet on an instance of MockServiceContainer.

func (ServiceContainerMustSetFuncCall) Args

func (c ServiceContainerMustSetFuncCall) Args() []interface{}

Args returns an interface slice containing the arguments of this invocation.

func (ServiceContainerMustSetFuncCall) Results

func (c ServiceContainerMustSetFuncCall) Results() []interface{}

Results returns an interface slice containing the results of this invocation.

type ServiceContainerSetFunc

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

ServiceContainerSetFunc describes the behavior when the Set method of the parent MockServiceContainer instance is invoked.

func (*ServiceContainerSetFunc) History

History returns a sequence of ServiceContainerSetFuncCall objects describing the invocations of this function.

func (*ServiceContainerSetFunc) PushHook

func (f *ServiceContainerSetFunc) PushHook(hook func(string, interface{}) error)

PushHook adds a function to the end of hook queue. Each invocation of the Set method of the parent MockServiceContainer instance invokes the hook at the front of the queue and discards it. After the queue is empty, the default hook function is invoked for any future action.

func (*ServiceContainerSetFunc) PushReturn

func (f *ServiceContainerSetFunc) PushReturn(r0 error)

PushReturn calls PushDefaultHook with a function that returns the given values.

func (*ServiceContainerSetFunc) SetDefaultHook

func (f *ServiceContainerSetFunc) SetDefaultHook(hook func(string, interface{}) error)

SetDefaultHook sets function that is called when the Set method of the parent MockServiceContainer instance is invoked and the hook queue is empty.

func (*ServiceContainerSetFunc) SetDefaultReturn

func (f *ServiceContainerSetFunc) SetDefaultReturn(r0 error)

SetDefaultReturn calls SetDefaultDefaultHook with a function that returns the given values.

type ServiceContainerSetFuncCall

type ServiceContainerSetFuncCall struct {
	// Arg0 is the value of the 1st argument passed to this method
	// invocation.
	Arg0 string
	// Arg1 is the value of the 2nd argument passed to this method
	// invocation.
	Arg1 interface{}
	// Result0 is the value of the 1st result returned from this method
	// invocation.
	Result0 error
}

ServiceContainerSetFuncCall is an object that describes an invocation of method Set on an instance of MockServiceContainer.

func (ServiceContainerSetFuncCall) Args

func (c ServiceContainerSetFuncCall) Args() []interface{}

Args returns an interface slice containing the arguments of this invocation.

func (ServiceContainerSetFuncCall) Results

func (c ServiceContainerSetFuncCall) Results() []interface{}

Results returns an interface slice containing the results of this invocation.

Jump to

Keyboard shortcuts

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