joshuar-go-hass-agent/internal/preferences/worker_mocks_test.go

105 lines
2.9 KiB
Go

// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package preferences
import (
"sync"
)
// Ensure, that WorkerMock does implement Worker.
// If this is not the case, regenerate this file with moq.
var _ Worker[any] = &WorkerMock[any]{}
// WorkerMock is a mock implementation of Worker.
//
// func TestSomethingThatUsesWorker(t *testing.T) {
//
// // make and configure a mocked Worker
// mockedWorker := &WorkerMock{
// DefaultPreferencesFunc: func() T {
// panic("mock out the DefaultPreferences method")
// },
// PreferencesIDFunc: func() string {
// panic("mock out the PreferencesID method")
// },
// }
//
// // use mockedWorker in code that requires Worker
// // and then make assertions.
//
// }
type WorkerMock[T any] struct {
// DefaultPreferencesFunc mocks the DefaultPreferences method.
DefaultPreferencesFunc func() T
// PreferencesIDFunc mocks the PreferencesID method.
PreferencesIDFunc func() string
// calls tracks calls to the methods.
calls struct {
// DefaultPreferences holds details about calls to the DefaultPreferences method.
DefaultPreferences []struct {
}
// PreferencesID holds details about calls to the PreferencesID method.
PreferencesID []struct {
}
}
lockDefaultPreferences sync.RWMutex
lockPreferencesID sync.RWMutex
}
// DefaultPreferences calls DefaultPreferencesFunc.
func (mock *WorkerMock[T]) DefaultPreferences() T {
if mock.DefaultPreferencesFunc == nil {
panic("WorkerMock.DefaultPreferencesFunc: method is nil but Worker.DefaultPreferences was just called")
}
callInfo := struct {
}{}
mock.lockDefaultPreferences.Lock()
mock.calls.DefaultPreferences = append(mock.calls.DefaultPreferences, callInfo)
mock.lockDefaultPreferences.Unlock()
return mock.DefaultPreferencesFunc()
}
// DefaultPreferencesCalls gets all the calls that were made to DefaultPreferences.
// Check the length with:
//
// len(mockedWorker.DefaultPreferencesCalls())
func (mock *WorkerMock[T]) DefaultPreferencesCalls() []struct {
} {
var calls []struct {
}
mock.lockDefaultPreferences.RLock()
calls = mock.calls.DefaultPreferences
mock.lockDefaultPreferences.RUnlock()
return calls
}
// PreferencesID calls PreferencesIDFunc.
func (mock *WorkerMock[T]) PreferencesID() string {
if mock.PreferencesIDFunc == nil {
panic("WorkerMock.PreferencesIDFunc: method is nil but Worker.PreferencesID was just called")
}
callInfo := struct {
}{}
mock.lockPreferencesID.Lock()
mock.calls.PreferencesID = append(mock.calls.PreferencesID, callInfo)
mock.lockPreferencesID.Unlock()
return mock.PreferencesIDFunc()
}
// PreferencesIDCalls gets all the calls that were made to PreferencesID.
// Check the length with:
//
// len(mockedWorker.PreferencesIDCalls())
func (mock *WorkerMock[T]) PreferencesIDCalls() []struct {
} {
var calls []struct {
}
mock.lockPreferencesID.RLock()
calls = mock.calls.PreferencesID
mock.lockPreferencesID.RUnlock()
return calls
}