/
listitem_mock.go
65 lines (58 loc) · 1.51 KB
/
listitem_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package fake
import (
"sync"
"sigs.k8s.io/controller-runtime/pkg/client"
)
// ListItemMock is a mock implementation of common.ListItem.
//
// func TestSomethingThatUsesListItem(t *testing.T) {
//
// // make and configure a mocked common.ListItem
// mockedListItem := &ListItemMock{
// GetItemsFunc: func() []client.Object {
// panic("mock out the GetItems method")
// },
// }
//
// // use mockedListItem in code that requires common.ListItem
// // and then make assertions.
//
// }
type ListItemMock struct {
// GetItemsFunc mocks the GetItems method.
GetItemsFunc func() []client.Object
// calls tracks calls to the methods.
calls struct {
// GetItems holds details about calls to the GetItems method.
GetItems []struct {
}
}
lockGetItems sync.RWMutex
}
// GetItems calls GetItemsFunc.
func (mock *ListItemMock) GetItems() []client.Object {
if mock.GetItemsFunc == nil {
panic("ListItemMock.GetItemsFunc: method is nil but ListItem.GetItems was just called")
}
callInfo := struct {
}{}
mock.lockGetItems.Lock()
mock.calls.GetItems = append(mock.calls.GetItems, callInfo)
mock.lockGetItems.Unlock()
return mock.GetItemsFunc()
}
// GetItemsCalls gets all the calls that were made to GetItems.
// Check the length with:
//
// len(mockedListItem.GetItemsCalls())
func (mock *ListItemMock) GetItemsCalls() []struct {
} {
var calls []struct {
}
mock.lockGetItems.RLock()
calls = mock.calls.GetItems
mock.lockGetItems.RUnlock()
return calls
}