-
Notifications
You must be signed in to change notification settings - Fork 4
/
mock_InitFn_test.go
108 lines (89 loc) · 3.02 KB
/
mock_InitFn_test.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
// Code generated by mockery. DO NOT EDIT.
package gosync
import (
context "context"
mock "github.com/stretchr/testify/mock"
)
// MockInitFn is an autogenerated mock type for the InitFn type
type MockInitFn[T Adapter] struct {
mock.Mock
}
type MockInitFn_Expecter[T Adapter] struct {
mock *mock.Mock
}
func (_m *MockInitFn[T]) EXPECT() *MockInitFn_Expecter[T] {
return &MockInitFn_Expecter[T]{mock: &_m.Mock}
}
// Execute provides a mock function with given fields: _a0, _a1, _a2
func (_m *MockInitFn[T]) Execute(_a0 context.Context, _a1 map[string]string, _a2 ...ConfigFn[T]) (T, error) {
_va := make([]interface{}, len(_a2))
for _i := range _a2 {
_va[_i] = _a2[_i]
}
var _ca []interface{}
_ca = append(_ca, _a0, _a1)
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
if len(ret) == 0 {
panic("no return value specified for Execute")
}
var r0 T
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, map[string]string, ...ConfigFn[T]) (T, error)); ok {
return rf(_a0, _a1, _a2...)
}
if rf, ok := ret.Get(0).(func(context.Context, map[string]string, ...ConfigFn[T]) T); ok {
r0 = rf(_a0, _a1, _a2...)
} else {
r0 = ret.Get(0).(T)
}
if rf, ok := ret.Get(1).(func(context.Context, map[string]string, ...ConfigFn[T]) error); ok {
r1 = rf(_a0, _a1, _a2...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockInitFn_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
type MockInitFn_Execute_Call[T Adapter] struct {
*mock.Call
}
// Execute is a helper method to define mock.On call
// - _a0 context.Context
// - _a1 map[string]string
// - _a2 ...ConfigFn[T]
func (_e *MockInitFn_Expecter[T]) Execute(_a0 interface{}, _a1 interface{}, _a2 ...interface{}) *MockInitFn_Execute_Call[T] {
return &MockInitFn_Execute_Call[T]{Call: _e.mock.On("Execute",
append([]interface{}{_a0, _a1}, _a2...)...)}
}
func (_c *MockInitFn_Execute_Call[T]) Run(run func(_a0 context.Context, _a1 map[string]string, _a2 ...ConfigFn[T])) *MockInitFn_Execute_Call[T] {
_c.Call.Run(func(args mock.Arguments) {
variadicArgs := make([]ConfigFn[T], len(args)-2)
for i, a := range args[2:] {
if a != nil {
variadicArgs[i] = a.(ConfigFn[T])
}
}
run(args[0].(context.Context), args[1].(map[string]string), variadicArgs...)
})
return _c
}
func (_c *MockInitFn_Execute_Call[T]) Return(_a0 T, _a1 error) *MockInitFn_Execute_Call[T] {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockInitFn_Execute_Call[T]) RunAndReturn(run func(context.Context, map[string]string, ...ConfigFn[T]) (T, error)) *MockInitFn_Execute_Call[T] {
_c.Call.Return(run)
return _c
}
// NewMockInitFn creates a new instance of MockInitFn. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewMockInitFn[T Adapter](t interface {
mock.TestingT
Cleanup(func())
}) *MockInitFn[T] {
mock := &MockInitFn[T]{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}