-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathmock_connection_test.go
More file actions
503 lines (424 loc) · 16.3 KB
/
mock_connection_test.go
File metadata and controls
503 lines (424 loc) · 16.3 KB
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/mengelbart/moqtransport (interfaces: Connection)
//
// Generated by this command:
//
// mockgen -build_flags=-tags=gomock -typed -package moqtransport -write_package_comment=false -self_package github.com/mengelbart/moqtransport -destination mock_connection_test.go github.com/mengelbart/moqtransport Connection
//
package moqtransport
import (
context "context"
reflect "reflect"
gomock "go.uber.org/mock/gomock"
)
// MockConnection is a mock of Connection interface.
type MockConnection struct {
ctrl *gomock.Controller
recorder *MockConnectionMockRecorder
isgomock struct{}
}
// MockConnectionMockRecorder is the mock recorder for MockConnection.
type MockConnectionMockRecorder struct {
mock *MockConnection
}
// NewMockConnection creates a new mock instance.
func NewMockConnection(ctrl *gomock.Controller) *MockConnection {
mock := &MockConnection{ctrl: ctrl}
mock.recorder = &MockConnectionMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockConnection) EXPECT() *MockConnectionMockRecorder {
return m.recorder
}
// AcceptStream mocks base method.
func (m *MockConnection) AcceptStream(arg0 context.Context) (Stream, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AcceptStream", arg0)
ret0, _ := ret[0].(Stream)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// AcceptStream indicates an expected call of AcceptStream.
func (mr *MockConnectionMockRecorder) AcceptStream(arg0 any) *MockConnectionAcceptStreamCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptStream", reflect.TypeOf((*MockConnection)(nil).AcceptStream), arg0)
return &MockConnectionAcceptStreamCall{Call: call}
}
// MockConnectionAcceptStreamCall wrap *gomock.Call
type MockConnectionAcceptStreamCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionAcceptStreamCall) Return(arg0 Stream, arg1 error) *MockConnectionAcceptStreamCall {
c.Call = c.Call.Return(arg0, arg1)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionAcceptStreamCall) Do(f func(context.Context) (Stream, error)) *MockConnectionAcceptStreamCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionAcceptStreamCall) DoAndReturn(f func(context.Context) (Stream, error)) *MockConnectionAcceptStreamCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// AcceptUniStream mocks base method.
func (m *MockConnection) AcceptUniStream(arg0 context.Context) (ReceiveStream, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AcceptUniStream", arg0)
ret0, _ := ret[0].(ReceiveStream)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// AcceptUniStream indicates an expected call of AcceptUniStream.
func (mr *MockConnectionMockRecorder) AcceptUniStream(arg0 any) *MockConnectionAcceptUniStreamCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptUniStream", reflect.TypeOf((*MockConnection)(nil).AcceptUniStream), arg0)
return &MockConnectionAcceptUniStreamCall{Call: call}
}
// MockConnectionAcceptUniStreamCall wrap *gomock.Call
type MockConnectionAcceptUniStreamCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionAcceptUniStreamCall) Return(arg0 ReceiveStream, arg1 error) *MockConnectionAcceptUniStreamCall {
c.Call = c.Call.Return(arg0, arg1)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionAcceptUniStreamCall) Do(f func(context.Context) (ReceiveStream, error)) *MockConnectionAcceptUniStreamCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionAcceptUniStreamCall) DoAndReturn(f func(context.Context) (ReceiveStream, error)) *MockConnectionAcceptUniStreamCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// CloseWithError mocks base method.
func (m *MockConnection) CloseWithError(arg0 uint64, arg1 string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CloseWithError", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// CloseWithError indicates an expected call of CloseWithError.
func (mr *MockConnectionMockRecorder) CloseWithError(arg0, arg1 any) *MockConnectionCloseWithErrorCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseWithError", reflect.TypeOf((*MockConnection)(nil).CloseWithError), arg0, arg1)
return &MockConnectionCloseWithErrorCall{Call: call}
}
// MockConnectionCloseWithErrorCall wrap *gomock.Call
type MockConnectionCloseWithErrorCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionCloseWithErrorCall) Return(arg0 error) *MockConnectionCloseWithErrorCall {
c.Call = c.Call.Return(arg0)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionCloseWithErrorCall) Do(f func(uint64, string) error) *MockConnectionCloseWithErrorCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionCloseWithErrorCall) DoAndReturn(f func(uint64, string) error) *MockConnectionCloseWithErrorCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// Context mocks base method.
func (m *MockConnection) Context() context.Context {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Context")
ret0, _ := ret[0].(context.Context)
return ret0
}
// Context indicates an expected call of Context.
func (mr *MockConnectionMockRecorder) Context() *MockConnectionContextCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockConnection)(nil).Context))
return &MockConnectionContextCall{Call: call}
}
// MockConnectionContextCall wrap *gomock.Call
type MockConnectionContextCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionContextCall) Return(arg0 context.Context) *MockConnectionContextCall {
c.Call = c.Call.Return(arg0)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionContextCall) Do(f func() context.Context) *MockConnectionContextCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionContextCall) DoAndReturn(f func() context.Context) *MockConnectionContextCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// OpenStream mocks base method.
func (m *MockConnection) OpenStream() (Stream, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "OpenStream")
ret0, _ := ret[0].(Stream)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// OpenStream indicates an expected call of OpenStream.
func (mr *MockConnectionMockRecorder) OpenStream() *MockConnectionOpenStreamCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenStream", reflect.TypeOf((*MockConnection)(nil).OpenStream))
return &MockConnectionOpenStreamCall{Call: call}
}
// MockConnectionOpenStreamCall wrap *gomock.Call
type MockConnectionOpenStreamCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionOpenStreamCall) Return(arg0 Stream, arg1 error) *MockConnectionOpenStreamCall {
c.Call = c.Call.Return(arg0, arg1)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionOpenStreamCall) Do(f func() (Stream, error)) *MockConnectionOpenStreamCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionOpenStreamCall) DoAndReturn(f func() (Stream, error)) *MockConnectionOpenStreamCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// OpenStreamSync mocks base method.
func (m *MockConnection) OpenStreamSync(arg0 context.Context) (Stream, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "OpenStreamSync", arg0)
ret0, _ := ret[0].(Stream)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// OpenStreamSync indicates an expected call of OpenStreamSync.
func (mr *MockConnectionMockRecorder) OpenStreamSync(arg0 any) *MockConnectionOpenStreamSyncCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenStreamSync", reflect.TypeOf((*MockConnection)(nil).OpenStreamSync), arg0)
return &MockConnectionOpenStreamSyncCall{Call: call}
}
// MockConnectionOpenStreamSyncCall wrap *gomock.Call
type MockConnectionOpenStreamSyncCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionOpenStreamSyncCall) Return(arg0 Stream, arg1 error) *MockConnectionOpenStreamSyncCall {
c.Call = c.Call.Return(arg0, arg1)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionOpenStreamSyncCall) Do(f func(context.Context) (Stream, error)) *MockConnectionOpenStreamSyncCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionOpenStreamSyncCall) DoAndReturn(f func(context.Context) (Stream, error)) *MockConnectionOpenStreamSyncCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// OpenUniStream mocks base method.
func (m *MockConnection) OpenUniStream() (SendStream, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "OpenUniStream")
ret0, _ := ret[0].(SendStream)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// OpenUniStream indicates an expected call of OpenUniStream.
func (mr *MockConnectionMockRecorder) OpenUniStream() *MockConnectionOpenUniStreamCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenUniStream", reflect.TypeOf((*MockConnection)(nil).OpenUniStream))
return &MockConnectionOpenUniStreamCall{Call: call}
}
// MockConnectionOpenUniStreamCall wrap *gomock.Call
type MockConnectionOpenUniStreamCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionOpenUniStreamCall) Return(arg0 SendStream, arg1 error) *MockConnectionOpenUniStreamCall {
c.Call = c.Call.Return(arg0, arg1)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionOpenUniStreamCall) Do(f func() (SendStream, error)) *MockConnectionOpenUniStreamCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionOpenUniStreamCall) DoAndReturn(f func() (SendStream, error)) *MockConnectionOpenUniStreamCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// OpenUniStreamSync mocks base method.
func (m *MockConnection) OpenUniStreamSync(arg0 context.Context) (SendStream, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "OpenUniStreamSync", arg0)
ret0, _ := ret[0].(SendStream)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// OpenUniStreamSync indicates an expected call of OpenUniStreamSync.
func (mr *MockConnectionMockRecorder) OpenUniStreamSync(arg0 any) *MockConnectionOpenUniStreamSyncCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenUniStreamSync", reflect.TypeOf((*MockConnection)(nil).OpenUniStreamSync), arg0)
return &MockConnectionOpenUniStreamSyncCall{Call: call}
}
// MockConnectionOpenUniStreamSyncCall wrap *gomock.Call
type MockConnectionOpenUniStreamSyncCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionOpenUniStreamSyncCall) Return(arg0 SendStream, arg1 error) *MockConnectionOpenUniStreamSyncCall {
c.Call = c.Call.Return(arg0, arg1)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionOpenUniStreamSyncCall) Do(f func(context.Context) (SendStream, error)) *MockConnectionOpenUniStreamSyncCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionOpenUniStreamSyncCall) DoAndReturn(f func(context.Context) (SendStream, error)) *MockConnectionOpenUniStreamSyncCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// Perspective mocks base method.
func (m *MockConnection) Perspective() Perspective {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Perspective")
ret0, _ := ret[0].(Perspective)
return ret0
}
// Perspective indicates an expected call of Perspective.
func (mr *MockConnectionMockRecorder) Perspective() *MockConnectionPerspectiveCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Perspective", reflect.TypeOf((*MockConnection)(nil).Perspective))
return &MockConnectionPerspectiveCall{Call: call}
}
// MockConnectionPerspectiveCall wrap *gomock.Call
type MockConnectionPerspectiveCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionPerspectiveCall) Return(arg0 Perspective) *MockConnectionPerspectiveCall {
c.Call = c.Call.Return(arg0)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionPerspectiveCall) Do(f func() Perspective) *MockConnectionPerspectiveCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionPerspectiveCall) DoAndReturn(f func() Perspective) *MockConnectionPerspectiveCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// Protocol mocks base method.
func (m *MockConnection) Protocol() Protocol {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Protocol")
ret0, _ := ret[0].(Protocol)
return ret0
}
// Protocol indicates an expected call of Protocol.
func (mr *MockConnectionMockRecorder) Protocol() *MockConnectionProtocolCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Protocol", reflect.TypeOf((*MockConnection)(nil).Protocol))
return &MockConnectionProtocolCall{Call: call}
}
// MockConnectionProtocolCall wrap *gomock.Call
type MockConnectionProtocolCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionProtocolCall) Return(arg0 Protocol) *MockConnectionProtocolCall {
c.Call = c.Call.Return(arg0)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionProtocolCall) Do(f func() Protocol) *MockConnectionProtocolCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionProtocolCall) DoAndReturn(f func() Protocol) *MockConnectionProtocolCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// ReceiveDatagram mocks base method.
func (m *MockConnection) ReceiveDatagram(arg0 context.Context) ([]byte, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ReceiveDatagram", arg0)
ret0, _ := ret[0].([]byte)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ReceiveDatagram indicates an expected call of ReceiveDatagram.
func (mr *MockConnectionMockRecorder) ReceiveDatagram(arg0 any) *MockConnectionReceiveDatagramCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceiveDatagram", reflect.TypeOf((*MockConnection)(nil).ReceiveDatagram), arg0)
return &MockConnectionReceiveDatagramCall{Call: call}
}
// MockConnectionReceiveDatagramCall wrap *gomock.Call
type MockConnectionReceiveDatagramCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionReceiveDatagramCall) Return(arg0 []byte, arg1 error) *MockConnectionReceiveDatagramCall {
c.Call = c.Call.Return(arg0, arg1)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionReceiveDatagramCall) Do(f func(context.Context) ([]byte, error)) *MockConnectionReceiveDatagramCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionReceiveDatagramCall) DoAndReturn(f func(context.Context) ([]byte, error)) *MockConnectionReceiveDatagramCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// SendDatagram mocks base method.
func (m *MockConnection) SendDatagram(arg0 []byte) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendDatagram", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SendDatagram indicates an expected call of SendDatagram.
func (mr *MockConnectionMockRecorder) SendDatagram(arg0 any) *MockConnectionSendDatagramCall {
mr.mock.ctrl.T.Helper()
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendDatagram", reflect.TypeOf((*MockConnection)(nil).SendDatagram), arg0)
return &MockConnectionSendDatagramCall{Call: call}
}
// MockConnectionSendDatagramCall wrap *gomock.Call
type MockConnectionSendDatagramCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *MockConnectionSendDatagramCall) Return(arg0 error) *MockConnectionSendDatagramCall {
c.Call = c.Call.Return(arg0)
return c
}
// Do rewrite *gomock.Call.Do
func (c *MockConnectionSendDatagramCall) Do(f func([]byte) error) *MockConnectionSendDatagramCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *MockConnectionSendDatagramCall) DoAndReturn(f func([]byte) error) *MockConnectionSendDatagramCall {
c.Call = c.Call.DoAndReturn(f)
return c
}