mirror of
https://github.com/kemko/reproxy.git
synced 2026-01-01 15:55:49 +03:00
64 lines
1.4 KiB
Go
64 lines
1.4 KiB
Go
// Code generated by moq; DO NOT EDIT.
|
|
// github.com/matryer/moq
|
|
|
|
package consulcatalog
|
|
|
|
import (
|
|
"sync"
|
|
)
|
|
|
|
// ConsulClientMock is a mock implementation of ConsulClient.
|
|
//
|
|
// func TestSomethingThatUsesConsulClient(t *testing.T) {
|
|
//
|
|
// // make and configure a mocked ConsulClient
|
|
// mockedConsulClient := &ConsulClientMock{
|
|
// GetFunc: func() ([]consulService, error) {
|
|
// panic("mock out the Get method")
|
|
// },
|
|
// }
|
|
//
|
|
// // use mockedConsulClient in code that requires ConsulClient
|
|
// // and then make assertions.
|
|
//
|
|
// }
|
|
type ConsulClientMock struct {
|
|
// GetFunc mocks the Get method.
|
|
GetFunc func() ([]consulService, error)
|
|
|
|
// calls tracks calls to the methods.
|
|
calls struct {
|
|
// Get holds details about calls to the Get method.
|
|
Get []struct {
|
|
}
|
|
}
|
|
lockGet sync.RWMutex
|
|
}
|
|
|
|
// Get calls GetFunc.
|
|
func (mock *ConsulClientMock) Get() ([]consulService, error) {
|
|
if mock.GetFunc == nil {
|
|
panic("ConsulClientMock.GetFunc: method is nil but ConsulClient.Get was just called")
|
|
}
|
|
callInfo := struct {
|
|
}{}
|
|
mock.lockGet.Lock()
|
|
mock.calls.Get = append(mock.calls.Get, callInfo)
|
|
mock.lockGet.Unlock()
|
|
return mock.GetFunc()
|
|
}
|
|
|
|
// GetCalls gets all the calls that were made to Get.
|
|
// Check the length with:
|
|
//
|
|
// len(mockedConsulClient.GetCalls())
|
|
func (mock *ConsulClientMock) GetCalls() []struct {
|
|
} {
|
|
var calls []struct {
|
|
}
|
|
mock.lockGet.RLock()
|
|
calls = mock.calls.Get
|
|
mock.lockGet.RUnlock()
|
|
return calls
|
|
}
|