2022-03-09 15:51:51 +00:00
|
|
|
// Code generated by moq; DO NOT EDIT.
|
|
|
|
// github.com/matryer/moq
|
|
|
|
|
|
|
|
package lookup
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Ensure, that LocatorMock does implement Locator.
|
|
|
|
// If this is not the case, regenerate this file with moq.
|
|
|
|
var _ Locator = &LocatorMock{}
|
|
|
|
|
|
|
|
// LocatorMock is a mock implementation of Locator.
|
|
|
|
//
|
|
|
|
// func TestSomethingThatUsesLocator(t *testing.T) {
|
|
|
|
//
|
|
|
|
// // make and configure a mocked Locator
|
|
|
|
// mockedLocator := &LocatorMock{
|
|
|
|
// LocateFunc: func(s string) ([]string, error) {
|
|
|
|
// panic("mock out the Locate method")
|
|
|
|
// },
|
2022-06-29 14:50:17 +00:00
|
|
|
// RelativeFunc: func(s string) (string, error) {
|
|
|
|
// panic("mock out the Relative method")
|
|
|
|
// },
|
2022-03-09 15:51:51 +00:00
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // use mockedLocator in code that requires Locator
|
|
|
|
// // and then make assertions.
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
type LocatorMock struct {
|
|
|
|
// LocateFunc mocks the Locate method.
|
|
|
|
LocateFunc func(s string) ([]string, error)
|
|
|
|
|
2022-06-29 14:50:17 +00:00
|
|
|
// RelativeFunc mocks the Relative method.
|
|
|
|
RelativeFunc func(s string) (string, error)
|
|
|
|
|
2022-03-09 15:51:51 +00:00
|
|
|
// calls tracks calls to the methods.
|
|
|
|
calls struct {
|
|
|
|
// Locate holds details about calls to the Locate method.
|
|
|
|
Locate []struct {
|
|
|
|
// S is the s argument value.
|
|
|
|
S string
|
|
|
|
}
|
2022-06-29 14:50:17 +00:00
|
|
|
// Relative holds details about calls to the Relative method.
|
|
|
|
Relative []struct {
|
|
|
|
// S is the s argument value.
|
|
|
|
S string
|
|
|
|
}
|
2022-03-09 15:51:51 +00:00
|
|
|
}
|
2022-06-29 14:50:17 +00:00
|
|
|
lockLocate sync.RWMutex
|
|
|
|
lockRelative sync.RWMutex
|
2022-03-09 15:51:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Locate calls LocateFunc.
|
|
|
|
func (mock *LocatorMock) Locate(s string) ([]string, error) {
|
|
|
|
callInfo := struct {
|
|
|
|
S string
|
|
|
|
}{
|
|
|
|
S: s,
|
|
|
|
}
|
|
|
|
mock.lockLocate.Lock()
|
|
|
|
mock.calls.Locate = append(mock.calls.Locate, callInfo)
|
|
|
|
mock.lockLocate.Unlock()
|
|
|
|
if mock.LocateFunc == nil {
|
|
|
|
var (
|
|
|
|
stringsOut []string
|
|
|
|
errOut error
|
|
|
|
)
|
|
|
|
return stringsOut, errOut
|
|
|
|
}
|
|
|
|
return mock.LocateFunc(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
// LocateCalls gets all the calls that were made to Locate.
|
|
|
|
// Check the length with:
|
|
|
|
// len(mockedLocator.LocateCalls())
|
|
|
|
func (mock *LocatorMock) LocateCalls() []struct {
|
|
|
|
S string
|
|
|
|
} {
|
|
|
|
var calls []struct {
|
|
|
|
S string
|
|
|
|
}
|
|
|
|
mock.lockLocate.RLock()
|
|
|
|
calls = mock.calls.Locate
|
|
|
|
mock.lockLocate.RUnlock()
|
|
|
|
return calls
|
|
|
|
}
|
2022-06-29 14:50:17 +00:00
|
|
|
|
|
|
|
// Relative calls RelativeFunc.
|
|
|
|
func (mock *LocatorMock) Relative(s string) (string, error) {
|
|
|
|
callInfo := struct {
|
|
|
|
S string
|
|
|
|
}{
|
|
|
|
S: s,
|
|
|
|
}
|
|
|
|
mock.lockRelative.Lock()
|
|
|
|
mock.calls.Relative = append(mock.calls.Relative, callInfo)
|
|
|
|
mock.lockRelative.Unlock()
|
|
|
|
if mock.RelativeFunc == nil {
|
|
|
|
var (
|
|
|
|
sOut string
|
|
|
|
errOut error
|
|
|
|
)
|
|
|
|
return sOut, errOut
|
|
|
|
}
|
|
|
|
return mock.RelativeFunc(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
// RelativeCalls gets all the calls that were made to Relative.
|
|
|
|
// Check the length with:
|
|
|
|
// len(mockedLocator.RelativeCalls())
|
|
|
|
func (mock *LocatorMock) RelativeCalls() []struct {
|
|
|
|
S string
|
|
|
|
} {
|
|
|
|
var calls []struct {
|
|
|
|
S string
|
|
|
|
}
|
|
|
|
mock.lockRelative.RLock()
|
|
|
|
calls = mock.calls.Relative
|
|
|
|
mock.lockRelative.RUnlock()
|
|
|
|
return calls
|
|
|
|
}
|