150 lines
3.8 KiB
Go
150 lines
3.8 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package agent
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
)
|
|
|
|
// Ensure, that DeviceMock does implement Device.
|
|
// If this is not the case, regenerate this file with moq.
|
|
var _ Device = &DeviceMock{}
|
|
|
|
// DeviceMock is a mock implementation of Device.
|
|
//
|
|
// func TestSomethingThatUsesDevice(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked Device
|
|
// mockedDevice := &DeviceMock{
|
|
// DeviceIDFunc: func() string {
|
|
// panic("mock out the DeviceID method")
|
|
// },
|
|
// DeviceNameFunc: func() string {
|
|
// panic("mock out the DeviceName method")
|
|
// },
|
|
// SetupFunc: func(contextMoqParam context.Context) context.Context {
|
|
// panic("mock out the Setup method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedDevice in code that requires Device
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type DeviceMock struct {
|
|
// DeviceIDFunc mocks the DeviceID method.
|
|
DeviceIDFunc func() string
|
|
|
|
// DeviceNameFunc mocks the DeviceName method.
|
|
DeviceNameFunc func() string
|
|
|
|
// SetupFunc mocks the Setup method.
|
|
SetupFunc func(contextMoqParam context.Context) context.Context
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// DeviceID holds details about calls to the DeviceID method.
|
|
DeviceID []struct {
|
|
}
|
|
// DeviceName holds details about calls to the DeviceName method.
|
|
DeviceName []struct {
|
|
}
|
|
// Setup holds details about calls to the Setup method.
|
|
Setup []struct {
|
|
// ContextMoqParam is the contextMoqParam argument value.
|
|
ContextMoqParam context.Context
|
|
}
|
|
}
|
|
lockDeviceID sync.RWMutex
|
|
lockDeviceName sync.RWMutex
|
|
lockSetup sync.RWMutex
|
|
}
|
|
|
|
// DeviceID calls DeviceIDFunc.
|
|
func (mock *DeviceMock) DeviceID() string {
|
|
if mock.DeviceIDFunc == nil {
|
|
panic("DeviceMock.DeviceIDFunc: method is nil but Device.DeviceID was just called")
|
|
}
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockDeviceID.Lock()
|
|
mock.calls.DeviceID = append(mock.calls.DeviceID, callInfo)
|
|
mock.lockDeviceID.Unlock()
|
|
return mock.DeviceIDFunc()
|
|
}
|
|
|
|
// DeviceIDCalls gets all the calls that were made to DeviceID.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedDevice.DeviceIDCalls())
|
|
func (mock *DeviceMock) DeviceIDCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockDeviceID.RLock()
|
|
calls = mock.calls.DeviceID
|
|
mock.lockDeviceID.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// DeviceName calls DeviceNameFunc.
|
|
func (mock *DeviceMock) DeviceName() string {
|
|
if mock.DeviceNameFunc == nil {
|
|
panic("DeviceMock.DeviceNameFunc: method is nil but Device.DeviceName was just called")
|
|
}
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockDeviceName.Lock()
|
|
mock.calls.DeviceName = append(mock.calls.DeviceName, callInfo)
|
|
mock.lockDeviceName.Unlock()
|
|
return mock.DeviceNameFunc()
|
|
}
|
|
|
|
// DeviceNameCalls gets all the calls that were made to DeviceName.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedDevice.DeviceNameCalls())
|
|
func (mock *DeviceMock) DeviceNameCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockDeviceName.RLock()
|
|
calls = mock.calls.DeviceName
|
|
mock.lockDeviceName.RUnlock()
|
|
return calls
|
|
}
|
|
|
|
// Setup calls SetupFunc.
|
|
func (mock *DeviceMock) Setup(contextMoqParam context.Context) context.Context {
|
|
if mock.SetupFunc == nil {
|
|
panic("DeviceMock.SetupFunc: method is nil but Device.Setup was just called")
|
|
}
|
|
callInfo := struct {
|
|
ContextMoqParam context.Context
|
|
}{
|
|
ContextMoqParam: contextMoqParam,
|
|
}
|
|
mock.lockSetup.Lock()
|
|
mock.calls.Setup = append(mock.calls.Setup, callInfo)
|
|
mock.lockSetup.Unlock()
|
|
return mock.SetupFunc(contextMoqParam)
|
|
}
|
|
|
|
// SetupCalls gets all the calls that were made to Setup.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedDevice.SetupCalls())
|
|
func (mock *DeviceMock) SetupCalls() []struct {
|
|
ContextMoqParam context.Context
|
|
} {
|
|
var calls []struct {
|
|
ContextMoqParam context.Context
|
|
}
|
|
mock.lockSetup.RLock()
|
|
calls = mock.calls.Setup
|
|
mock.lockSetup.RUnlock()
|
|
return calls
|
|
}
|