use new gomock feature to generate type-safe methods in mocks (#4057)

This commit is contained in:
Marten Seemann 2023-10-21 12:55:33 +07:00 committed by GitHub
parent b344940f06
commit a263164d9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 7933 additions and 754 deletions

View file

@ -3,7 +3,7 @@
//
// Generated by this command:
//
// mockgen -build_flags=-tags=gomock -package quic -self_package github.com/quic-go/quic-go -destination mock_packet_handler_manager_test.go github.com/quic-go/quic-go PacketHandlerManager
// mockgen -typed -build_flags=-tags=gomock -package quic -self_package github.com/quic-go/quic-go -destination mock_packet_handler_manager_test.go github.com/quic-go/quic-go PacketHandlerManager
//
// Package quic is a generated GoMock package.
package quic
@ -47,9 +47,33 @@ func (m *MockPacketHandlerManager) Add(arg0 protocol.ConnectionID, arg1 packetHa
}
// Add indicates an expected call of Add.
func (mr *MockPacketHandlerManagerMockRecorder) Add(arg0, arg1 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) Add(arg0, arg1 any) *PacketHandlerManagerAddCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Add", reflect.TypeOf((*MockPacketHandlerManager)(nil).Add), arg0, arg1)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Add", reflect.TypeOf((*MockPacketHandlerManager)(nil).Add), arg0, arg1)
return &PacketHandlerManagerAddCall{Call: call}
}
// PacketHandlerManagerAddCall wrap *gomock.Call
type PacketHandlerManagerAddCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerAddCall) Return(arg0 bool) *PacketHandlerManagerAddCall {
c.Call = c.Call.Return(arg0)
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerAddCall) Do(f func(protocol.ConnectionID, packetHandler) bool) *PacketHandlerManagerAddCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerAddCall) DoAndReturn(f func(protocol.ConnectionID, packetHandler) bool) *PacketHandlerManagerAddCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// AddResetToken mocks base method.
@ -59,9 +83,33 @@ func (m *MockPacketHandlerManager) AddResetToken(arg0 protocol.StatelessResetTok
}
// AddResetToken indicates an expected call of AddResetToken.
func (mr *MockPacketHandlerManagerMockRecorder) AddResetToken(arg0, arg1 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) AddResetToken(arg0, arg1 any) *PacketHandlerManagerAddResetTokenCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddResetToken", reflect.TypeOf((*MockPacketHandlerManager)(nil).AddResetToken), arg0, arg1)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddResetToken", reflect.TypeOf((*MockPacketHandlerManager)(nil).AddResetToken), arg0, arg1)
return &PacketHandlerManagerAddResetTokenCall{Call: call}
}
// PacketHandlerManagerAddResetTokenCall wrap *gomock.Call
type PacketHandlerManagerAddResetTokenCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerAddResetTokenCall) Return() *PacketHandlerManagerAddResetTokenCall {
c.Call = c.Call.Return()
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerAddResetTokenCall) Do(f func(protocol.StatelessResetToken, packetHandler)) *PacketHandlerManagerAddResetTokenCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerAddResetTokenCall) DoAndReturn(f func(protocol.StatelessResetToken, packetHandler)) *PacketHandlerManagerAddResetTokenCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// AddWithConnID mocks base method.
@ -73,9 +121,33 @@ func (m *MockPacketHandlerManager) AddWithConnID(arg0, arg1 protocol.ConnectionI
}
// AddWithConnID indicates an expected call of AddWithConnID.
func (mr *MockPacketHandlerManagerMockRecorder) AddWithConnID(arg0, arg1, arg2 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) AddWithConnID(arg0, arg1, arg2 any) *PacketHandlerManagerAddWithConnIDCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddWithConnID", reflect.TypeOf((*MockPacketHandlerManager)(nil).AddWithConnID), arg0, arg1, arg2)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddWithConnID", reflect.TypeOf((*MockPacketHandlerManager)(nil).AddWithConnID), arg0, arg1, arg2)
return &PacketHandlerManagerAddWithConnIDCall{Call: call}
}
// PacketHandlerManagerAddWithConnIDCall wrap *gomock.Call
type PacketHandlerManagerAddWithConnIDCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerAddWithConnIDCall) Return(arg0 bool) *PacketHandlerManagerAddWithConnIDCall {
c.Call = c.Call.Return(arg0)
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerAddWithConnIDCall) Do(f func(protocol.ConnectionID, protocol.ConnectionID, func() (packetHandler, bool)) bool) *PacketHandlerManagerAddWithConnIDCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerAddWithConnIDCall) DoAndReturn(f func(protocol.ConnectionID, protocol.ConnectionID, func() (packetHandler, bool)) bool) *PacketHandlerManagerAddWithConnIDCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// Close mocks base method.
@ -85,9 +157,33 @@ func (m *MockPacketHandlerManager) Close(arg0 error) {
}
// Close indicates an expected call of Close.
func (mr *MockPacketHandlerManagerMockRecorder) Close(arg0 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) Close(arg0 any) *PacketHandlerManagerCloseCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPacketHandlerManager)(nil).Close), arg0)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPacketHandlerManager)(nil).Close), arg0)
return &PacketHandlerManagerCloseCall{Call: call}
}
// PacketHandlerManagerCloseCall wrap *gomock.Call
type PacketHandlerManagerCloseCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerCloseCall) Return() *PacketHandlerManagerCloseCall {
c.Call = c.Call.Return()
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerCloseCall) Do(f func(error)) *PacketHandlerManagerCloseCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerCloseCall) DoAndReturn(f func(error)) *PacketHandlerManagerCloseCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// CloseServer mocks base method.
@ -97,9 +193,33 @@ func (m *MockPacketHandlerManager) CloseServer() {
}
// CloseServer indicates an expected call of CloseServer.
func (mr *MockPacketHandlerManagerMockRecorder) CloseServer() *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) CloseServer() *PacketHandlerManagerCloseServerCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseServer", reflect.TypeOf((*MockPacketHandlerManager)(nil).CloseServer))
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseServer", reflect.TypeOf((*MockPacketHandlerManager)(nil).CloseServer))
return &PacketHandlerManagerCloseServerCall{Call: call}
}
// PacketHandlerManagerCloseServerCall wrap *gomock.Call
type PacketHandlerManagerCloseServerCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerCloseServerCall) Return() *PacketHandlerManagerCloseServerCall {
c.Call = c.Call.Return()
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerCloseServerCall) Do(f func()) *PacketHandlerManagerCloseServerCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerCloseServerCall) DoAndReturn(f func()) *PacketHandlerManagerCloseServerCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// Get mocks base method.
@ -112,9 +232,33 @@ func (m *MockPacketHandlerManager) Get(arg0 protocol.ConnectionID) (packetHandle
}
// Get indicates an expected call of Get.
func (mr *MockPacketHandlerManagerMockRecorder) Get(arg0 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) Get(arg0 any) *PacketHandlerManagerGetCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockPacketHandlerManager)(nil).Get), arg0)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockPacketHandlerManager)(nil).Get), arg0)
return &PacketHandlerManagerGetCall{Call: call}
}
// PacketHandlerManagerGetCall wrap *gomock.Call
type PacketHandlerManagerGetCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerGetCall) Return(arg0 packetHandler, arg1 bool) *PacketHandlerManagerGetCall {
c.Call = c.Call.Return(arg0, arg1)
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerGetCall) Do(f func(protocol.ConnectionID) (packetHandler, bool)) *PacketHandlerManagerGetCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerGetCall) DoAndReturn(f func(protocol.ConnectionID) (packetHandler, bool)) *PacketHandlerManagerGetCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// GetByResetToken mocks base method.
@ -127,9 +271,33 @@ func (m *MockPacketHandlerManager) GetByResetToken(arg0 protocol.StatelessResetT
}
// GetByResetToken indicates an expected call of GetByResetToken.
func (mr *MockPacketHandlerManagerMockRecorder) GetByResetToken(arg0 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) GetByResetToken(arg0 any) *PacketHandlerManagerGetByResetTokenCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByResetToken", reflect.TypeOf((*MockPacketHandlerManager)(nil).GetByResetToken), arg0)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetByResetToken", reflect.TypeOf((*MockPacketHandlerManager)(nil).GetByResetToken), arg0)
return &PacketHandlerManagerGetByResetTokenCall{Call: call}
}
// PacketHandlerManagerGetByResetTokenCall wrap *gomock.Call
type PacketHandlerManagerGetByResetTokenCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerGetByResetTokenCall) Return(arg0 packetHandler, arg1 bool) *PacketHandlerManagerGetByResetTokenCall {
c.Call = c.Call.Return(arg0, arg1)
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerGetByResetTokenCall) Do(f func(protocol.StatelessResetToken) (packetHandler, bool)) *PacketHandlerManagerGetByResetTokenCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerGetByResetTokenCall) DoAndReturn(f func(protocol.StatelessResetToken) (packetHandler, bool)) *PacketHandlerManagerGetByResetTokenCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// GetStatelessResetToken mocks base method.
@ -141,9 +309,33 @@ func (m *MockPacketHandlerManager) GetStatelessResetToken(arg0 protocol.Connecti
}
// GetStatelessResetToken indicates an expected call of GetStatelessResetToken.
func (mr *MockPacketHandlerManagerMockRecorder) GetStatelessResetToken(arg0 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) GetStatelessResetToken(arg0 any) *PacketHandlerManagerGetStatelessResetTokenCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStatelessResetToken", reflect.TypeOf((*MockPacketHandlerManager)(nil).GetStatelessResetToken), arg0)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStatelessResetToken", reflect.TypeOf((*MockPacketHandlerManager)(nil).GetStatelessResetToken), arg0)
return &PacketHandlerManagerGetStatelessResetTokenCall{Call: call}
}
// PacketHandlerManagerGetStatelessResetTokenCall wrap *gomock.Call
type PacketHandlerManagerGetStatelessResetTokenCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerGetStatelessResetTokenCall) Return(arg0 protocol.StatelessResetToken) *PacketHandlerManagerGetStatelessResetTokenCall {
c.Call = c.Call.Return(arg0)
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerGetStatelessResetTokenCall) Do(f func(protocol.ConnectionID) protocol.StatelessResetToken) *PacketHandlerManagerGetStatelessResetTokenCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerGetStatelessResetTokenCall) DoAndReturn(f func(protocol.ConnectionID) protocol.StatelessResetToken) *PacketHandlerManagerGetStatelessResetTokenCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// Remove mocks base method.
@ -153,9 +345,33 @@ func (m *MockPacketHandlerManager) Remove(arg0 protocol.ConnectionID) {
}
// Remove indicates an expected call of Remove.
func (mr *MockPacketHandlerManagerMockRecorder) Remove(arg0 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) Remove(arg0 any) *PacketHandlerManagerRemoveCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*MockPacketHandlerManager)(nil).Remove), arg0)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remove", reflect.TypeOf((*MockPacketHandlerManager)(nil).Remove), arg0)
return &PacketHandlerManagerRemoveCall{Call: call}
}
// PacketHandlerManagerRemoveCall wrap *gomock.Call
type PacketHandlerManagerRemoveCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerRemoveCall) Return() *PacketHandlerManagerRemoveCall {
c.Call = c.Call.Return()
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerRemoveCall) Do(f func(protocol.ConnectionID)) *PacketHandlerManagerRemoveCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerRemoveCall) DoAndReturn(f func(protocol.ConnectionID)) *PacketHandlerManagerRemoveCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// RemoveResetToken mocks base method.
@ -165,9 +381,33 @@ func (m *MockPacketHandlerManager) RemoveResetToken(arg0 protocol.StatelessReset
}
// RemoveResetToken indicates an expected call of RemoveResetToken.
func (mr *MockPacketHandlerManagerMockRecorder) RemoveResetToken(arg0 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) RemoveResetToken(arg0 any) *PacketHandlerManagerRemoveResetTokenCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveResetToken", reflect.TypeOf((*MockPacketHandlerManager)(nil).RemoveResetToken), arg0)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveResetToken", reflect.TypeOf((*MockPacketHandlerManager)(nil).RemoveResetToken), arg0)
return &PacketHandlerManagerRemoveResetTokenCall{Call: call}
}
// PacketHandlerManagerRemoveResetTokenCall wrap *gomock.Call
type PacketHandlerManagerRemoveResetTokenCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerRemoveResetTokenCall) Return() *PacketHandlerManagerRemoveResetTokenCall {
c.Call = c.Call.Return()
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerRemoveResetTokenCall) Do(f func(protocol.StatelessResetToken)) *PacketHandlerManagerRemoveResetTokenCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerRemoveResetTokenCall) DoAndReturn(f func(protocol.StatelessResetToken)) *PacketHandlerManagerRemoveResetTokenCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// ReplaceWithClosed mocks base method.
@ -177,9 +417,33 @@ func (m *MockPacketHandlerManager) ReplaceWithClosed(arg0 []protocol.ConnectionI
}
// ReplaceWithClosed indicates an expected call of ReplaceWithClosed.
func (mr *MockPacketHandlerManagerMockRecorder) ReplaceWithClosed(arg0, arg1, arg2 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) ReplaceWithClosed(arg0, arg1, arg2 any) *PacketHandlerManagerReplaceWithClosedCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReplaceWithClosed", reflect.TypeOf((*MockPacketHandlerManager)(nil).ReplaceWithClosed), arg0, arg1, arg2)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReplaceWithClosed", reflect.TypeOf((*MockPacketHandlerManager)(nil).ReplaceWithClosed), arg0, arg1, arg2)
return &PacketHandlerManagerReplaceWithClosedCall{Call: call}
}
// PacketHandlerManagerReplaceWithClosedCall wrap *gomock.Call
type PacketHandlerManagerReplaceWithClosedCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerReplaceWithClosedCall) Return() *PacketHandlerManagerReplaceWithClosedCall {
c.Call = c.Call.Return()
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerReplaceWithClosedCall) Do(f func([]protocol.ConnectionID, protocol.Perspective, []byte)) *PacketHandlerManagerReplaceWithClosedCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerReplaceWithClosedCall) DoAndReturn(f func([]protocol.ConnectionID, protocol.Perspective, []byte)) *PacketHandlerManagerReplaceWithClosedCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// Retire mocks base method.
@ -189,7 +453,31 @@ func (m *MockPacketHandlerManager) Retire(arg0 protocol.ConnectionID) {
}
// Retire indicates an expected call of Retire.
func (mr *MockPacketHandlerManagerMockRecorder) Retire(arg0 any) *gomock.Call {
func (mr *MockPacketHandlerManagerMockRecorder) Retire(arg0 any) *PacketHandlerManagerRetireCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Retire", reflect.TypeOf((*MockPacketHandlerManager)(nil).Retire), arg0)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Retire", reflect.TypeOf((*MockPacketHandlerManager)(nil).Retire), arg0)
return &PacketHandlerManagerRetireCall{Call: call}
}
// PacketHandlerManagerRetireCall wrap *gomock.Call
type PacketHandlerManagerRetireCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *PacketHandlerManagerRetireCall) Return() *PacketHandlerManagerRetireCall {
c.Call = c.Call.Return()
return c
}
// Do rewrite *gomock.Call.Do
func (c *PacketHandlerManagerRetireCall) Do(f func(protocol.ConnectionID)) *PacketHandlerManagerRetireCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *PacketHandlerManagerRetireCall) DoAndReturn(f func(protocol.ConnectionID)) *PacketHandlerManagerRetireCall {
c.Call = c.Call.DoAndReturn(f)
return c
}