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
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 mocktls -destination tls/client_session_cache.go crypto/tls ClientSessionCache
// mockgen -typed -build_flags=-tags=gomock -package mocktls -destination tls/client_session_cache.go crypto/tls ClientSessionCache
//
// Package mocktls is a generated GoMock package.
package mocktls
@@ -48,9 +48,33 @@ func (m *MockClientSessionCache) Get(arg0 string) (*tls.ClientSessionState, bool
}
// Get indicates an expected call of Get.
func (mr *MockClientSessionCacheMockRecorder) Get(arg0 any) *gomock.Call {
func (mr *MockClientSessionCacheMockRecorder) Get(arg0 any) *ClientSessionCacheGetCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockClientSessionCache)(nil).Get), arg0)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockClientSessionCache)(nil).Get), arg0)
return &ClientSessionCacheGetCall{Call: call}
}
// ClientSessionCacheGetCall wrap *gomock.Call
type ClientSessionCacheGetCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *ClientSessionCacheGetCall) Return(arg0 *tls.ClientSessionState, arg1 bool) *ClientSessionCacheGetCall {
c.Call = c.Call.Return(arg0, arg1)
return c
}
// Do rewrite *gomock.Call.Do
func (c *ClientSessionCacheGetCall) Do(f func(string) (*tls.ClientSessionState, bool)) *ClientSessionCacheGetCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *ClientSessionCacheGetCall) DoAndReturn(f func(string) (*tls.ClientSessionState, bool)) *ClientSessionCacheGetCall {
c.Call = c.Call.DoAndReturn(f)
return c
}
// Put mocks base method.
@@ -60,7 +84,31 @@ func (m *MockClientSessionCache) Put(arg0 string, arg1 *tls.ClientSessionState)
}
// Put indicates an expected call of Put.
func (mr *MockClientSessionCacheMockRecorder) Put(arg0, arg1 any) *gomock.Call {
func (mr *MockClientSessionCacheMockRecorder) Put(arg0, arg1 any) *ClientSessionCachePutCall {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockClientSessionCache)(nil).Put), arg0, arg1)
call := mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockClientSessionCache)(nil).Put), arg0, arg1)
return &ClientSessionCachePutCall{Call: call}
}
// ClientSessionCachePutCall wrap *gomock.Call
type ClientSessionCachePutCall struct {
*gomock.Call
}
// Return rewrite *gomock.Call.Return
func (c *ClientSessionCachePutCall) Return() *ClientSessionCachePutCall {
c.Call = c.Call.Return()
return c
}
// Do rewrite *gomock.Call.Do
func (c *ClientSessionCachePutCall) Do(f func(string, *tls.ClientSessionState)) *ClientSessionCachePutCall {
c.Call = c.Call.Do(f)
return c
}
// DoAndReturn rewrite *gomock.Call.DoAndReturn
func (c *ClientSessionCachePutCall) DoAndReturn(f func(string, *tls.ClientSessionState)) *ClientSessionCachePutCall {
c.Call = c.Call.DoAndReturn(f)
return c
}