-
Notifications
You must be signed in to change notification settings - Fork 1
/
provider_mock.go
182 lines (148 loc) · 5.76 KB
/
provider_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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// Code generated by mockery v2.14.0. DO NOT EDIT.
package cache
import (
context "context"
time "time"
mock "github.com/stretchr/testify/mock"
)
// mockProvider is an autogenerated mock type for the Provider type
type mockProvider[T interface{}, V interface{}] struct {
mock.Mock
}
type mockProvider_Expecter[T interface{}, V interface{}] struct {
mock *mock.Mock
}
func (_m *mockProvider[T, V]) EXPECT() *mockProvider_Expecter[T, V] {
return &mockProvider_Expecter[T, V]{mock: &_m.Mock}
}
// Get provides a mock function with given fields: ctx, key, requiredModelVersion
func (_m *mockProvider[T, V]) Get(ctx context.Context, key *Key[V], requiredModelVersion uint16) (*T, error) {
ret := _m.Called(ctx, key, requiredModelVersion)
var r0 *T
if rf, ok := ret.Get(0).(func(context.Context, *Key[V], uint16) *T); ok {
r0 = rf(ctx, key, requiredModelVersion)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*T)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *Key[V], uint16) error); ok {
r1 = rf(ctx, key, requiredModelVersion)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// mockProvider_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
type mockProvider_Get_Call[T interface{}, V interface{}] struct {
*mock.Call
}
// Get is a helper method to define mock.On call
// - ctx context.Context
// - key *Key[V]
// - requiredModelVersion uint16
func (_e *mockProvider_Expecter[T, V]) Get(ctx interface{}, key interface{}, requiredModelVersion interface{}) *mockProvider_Get_Call[T, V] {
return &mockProvider_Get_Call[T, V]{Call: _e.mock.On("Get", ctx, key, requiredModelVersion)}
}
func (_c *mockProvider_Get_Call[T, V]) Run(run func(ctx context.Context, key *Key[V], requiredModelVersion uint16)) *mockProvider_Get_Call[T, V] {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*Key[V]), args[2].(uint16))
})
return _c
}
func (_c *mockProvider_Get_Call[T, V]) Return(_a0 *T, _a1 error) *mockProvider_Get_Call[T, V] {
_c.Call.Return(_a0, _a1)
return _c
}
// MGet provides a mock function with given fields: ctx, keys, requiredModelVersion
func (_m *mockProvider[T, V]) MGet(ctx context.Context, keys []*Key[V], requiredModelVersion uint16) (map[*Key[V]]*T, []*Key[V], error) {
ret := _m.Called(ctx, keys, requiredModelVersion)
var r0 map[*Key[V]]*T
if rf, ok := ret.Get(0).(func(context.Context, []*Key[V], uint16) map[*Key[V]]*T); ok {
r0 = rf(ctx, keys, requiredModelVersion)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(map[*Key[V]]*T)
}
}
var r1 []*Key[V]
if rf, ok := ret.Get(1).(func(context.Context, []*Key[V], uint16) []*Key[V]); ok {
r1 = rf(ctx, keys, requiredModelVersion)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).([]*Key[V])
}
}
var r2 error
if rf, ok := ret.Get(2).(func(context.Context, []*Key[V], uint16) error); ok {
r2 = rf(ctx, keys, requiredModelVersion)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// mockProvider_MGet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MGet'
type mockProvider_MGet_Call[T interface{}, V interface{}] struct {
*mock.Call
}
// MGet is a helper method to define mock.On call
// - ctx context.Context
// - keys []*Key[V]
// - requiredModelVersion uint16
func (_e *mockProvider_Expecter[T, V]) MGet(ctx interface{}, keys interface{}, requiredModelVersion interface{}) *mockProvider_MGet_Call[T, V] {
return &mockProvider_MGet_Call[T, V]{Call: _e.mock.On("MGet", ctx, keys, requiredModelVersion)}
}
func (_c *mockProvider_MGet_Call[T, V]) Run(run func(ctx context.Context, keys []*Key[V], requiredModelVersion uint16)) *mockProvider_MGet_Call[T, V] {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].([]*Key[V]), args[2].(uint16))
})
return _c
}
func (_c *mockProvider_MGet_Call[T, V]) Return(_a0 map[*Key[V]]*T, _a1 []*Key[V], _a2 error) *mockProvider_MGet_Call[T, V] {
_c.Call.Return(_a0, _a1, _a2)
return _c
}
// MSet provides a mock function with given fields: ctx, values, ttl
func (_m *mockProvider[T, V]) MSet(ctx context.Context, values map[string]*T, ttl time.Duration) error {
ret := _m.Called(ctx, values, ttl)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, map[string]*T, time.Duration) error); ok {
r0 = rf(ctx, values, ttl)
} else {
r0 = ret.Error(0)
}
return r0
}
// mockProvider_MSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MSet'
type mockProvider_MSet_Call[T interface{}, V interface{}] struct {
*mock.Call
}
// MSet is a helper method to define mock.On call
// - ctx context.Context
// - values map[string]*T
// - ttl time.Duration
func (_e *mockProvider_Expecter[T, V]) MSet(ctx interface{}, values interface{}, ttl interface{}) *mockProvider_MSet_Call[T, V] {
return &mockProvider_MSet_Call[T, V]{Call: _e.mock.On("MSet", ctx, values, ttl)}
}
func (_c *mockProvider_MSet_Call[T, V]) Run(run func(ctx context.Context, values map[string]*T, ttl time.Duration)) *mockProvider_MSet_Call[T, V] {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(map[string]*T), args[2].(time.Duration))
})
return _c
}
func (_c *mockProvider_MSet_Call[T, V]) Return(_a0 error) *mockProvider_MSet_Call[T, V] {
_c.Call.Return(_a0)
return _c
}
type mockConstructorTestingTnewMockProvider interface {
mock.TestingT
Cleanup(func())
}
// newMockProvider creates a new instance of mockProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func newMockProvider[T interface{}, V interface{}](t mockConstructorTestingTnewMockProvider) *mockProvider[T, V] {
mock := &mockProvider[T, V]{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}