-
Notifications
You must be signed in to change notification settings - Fork 105
/
types.go
207 lines (191 loc) · 5.97 KB
/
types.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package mock
import (
github_com_axelarnetwork_axelar_core_x_vote_exported "github.com/axelarnetwork/axelar-core/x/vote/exported"
"github.com/axelarnetwork/axelar-core/x/vote/types"
"sync"
)
// Ensure, that VoteRouterMock does implement types.VoteRouter.
// If this is not the case, regenerate this file with moq.
var _ types.VoteRouter = &VoteRouterMock{}
// VoteRouterMock is a mock implementation of types.VoteRouter.
//
// func TestSomethingThatUsesVoteRouter(t *testing.T) {
//
// // make and configure a mocked types.VoteRouter
// mockedVoteRouter := &VoteRouterMock{
// AddHandlerFunc: func(module string, handler github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler) types.VoteRouter {
// panic("mock out the AddHandler method")
// },
// GetHandlerFunc: func(module string) github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler {
// panic("mock out the GetHandler method")
// },
// HasHandlerFunc: func(module string) bool {
// panic("mock out the HasHandler method")
// },
// SealFunc: func() {
// panic("mock out the Seal method")
// },
// }
//
// // use mockedVoteRouter in code that requires types.VoteRouter
// // and then make assertions.
//
// }
type VoteRouterMock struct {
// AddHandlerFunc mocks the AddHandler method.
AddHandlerFunc func(module string, handler github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler) types.VoteRouter
// GetHandlerFunc mocks the GetHandler method.
GetHandlerFunc func(module string) github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler
// HasHandlerFunc mocks the HasHandler method.
HasHandlerFunc func(module string) bool
// SealFunc mocks the Seal method.
SealFunc func()
// calls tracks calls to the methods.
calls struct {
// AddHandler holds details about calls to the AddHandler method.
AddHandler []struct {
// Module is the module argument value.
Module string
// Handler is the handler argument value.
Handler github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler
}
// GetHandler holds details about calls to the GetHandler method.
GetHandler []struct {
// Module is the module argument value.
Module string
}
// HasHandler holds details about calls to the HasHandler method.
HasHandler []struct {
// Module is the module argument value.
Module string
}
// Seal holds details about calls to the Seal method.
Seal []struct {
}
}
lockAddHandler sync.RWMutex
lockGetHandler sync.RWMutex
lockHasHandler sync.RWMutex
lockSeal sync.RWMutex
}
// AddHandler calls AddHandlerFunc.
func (mock *VoteRouterMock) AddHandler(module string, handler github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler) types.VoteRouter {
if mock.AddHandlerFunc == nil {
panic("VoteRouterMock.AddHandlerFunc: method is nil but VoteRouter.AddHandler was just called")
}
callInfo := struct {
Module string
Handler github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler
}{
Module: module,
Handler: handler,
}
mock.lockAddHandler.Lock()
mock.calls.AddHandler = append(mock.calls.AddHandler, callInfo)
mock.lockAddHandler.Unlock()
return mock.AddHandlerFunc(module, handler)
}
// AddHandlerCalls gets all the calls that were made to AddHandler.
// Check the length with:
//
// len(mockedVoteRouter.AddHandlerCalls())
func (mock *VoteRouterMock) AddHandlerCalls() []struct {
Module string
Handler github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler
} {
var calls []struct {
Module string
Handler github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler
}
mock.lockAddHandler.RLock()
calls = mock.calls.AddHandler
mock.lockAddHandler.RUnlock()
return calls
}
// GetHandler calls GetHandlerFunc.
func (mock *VoteRouterMock) GetHandler(module string) github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler {
if mock.GetHandlerFunc == nil {
panic("VoteRouterMock.GetHandlerFunc: method is nil but VoteRouter.GetHandler was just called")
}
callInfo := struct {
Module string
}{
Module: module,
}
mock.lockGetHandler.Lock()
mock.calls.GetHandler = append(mock.calls.GetHandler, callInfo)
mock.lockGetHandler.Unlock()
return mock.GetHandlerFunc(module)
}
// GetHandlerCalls gets all the calls that were made to GetHandler.
// Check the length with:
//
// len(mockedVoteRouter.GetHandlerCalls())
func (mock *VoteRouterMock) GetHandlerCalls() []struct {
Module string
} {
var calls []struct {
Module string
}
mock.lockGetHandler.RLock()
calls = mock.calls.GetHandler
mock.lockGetHandler.RUnlock()
return calls
}
// HasHandler calls HasHandlerFunc.
func (mock *VoteRouterMock) HasHandler(module string) bool {
if mock.HasHandlerFunc == nil {
panic("VoteRouterMock.HasHandlerFunc: method is nil but VoteRouter.HasHandler was just called")
}
callInfo := struct {
Module string
}{
Module: module,
}
mock.lockHasHandler.Lock()
mock.calls.HasHandler = append(mock.calls.HasHandler, callInfo)
mock.lockHasHandler.Unlock()
return mock.HasHandlerFunc(module)
}
// HasHandlerCalls gets all the calls that were made to HasHandler.
// Check the length with:
//
// len(mockedVoteRouter.HasHandlerCalls())
func (mock *VoteRouterMock) HasHandlerCalls() []struct {
Module string
} {
var calls []struct {
Module string
}
mock.lockHasHandler.RLock()
calls = mock.calls.HasHandler
mock.lockHasHandler.RUnlock()
return calls
}
// Seal calls SealFunc.
func (mock *VoteRouterMock) Seal() {
if mock.SealFunc == nil {
panic("VoteRouterMock.SealFunc: method is nil but VoteRouter.Seal was just called")
}
callInfo := struct {
}{}
mock.lockSeal.Lock()
mock.calls.Seal = append(mock.calls.Seal, callInfo)
mock.lockSeal.Unlock()
mock.SealFunc()
}
// SealCalls gets all the calls that were made to Seal.
// Check the length with:
//
// len(mockedVoteRouter.SealCalls())
func (mock *VoteRouterMock) SealCalls() []struct {
} {
var calls []struct {
}
mock.lockSeal.RLock()
calls = mock.calls.Seal
mock.lockSeal.RUnlock()
return calls
}