common/mock_WithContext.go (69 lines of code) (raw):
// Code generated by mockery v2.53.3. DO NOT EDIT.
package common
import (
context "context"
mock "github.com/stretchr/testify/mock"
)
// MockWithContext is an autogenerated mock type for the WithContext type
type MockWithContext struct {
mock.Mock
}
type MockWithContext_Expecter struct {
mock *mock.Mock
}
func (_m *MockWithContext) EXPECT() *MockWithContext_Expecter {
return &MockWithContext_Expecter{mock: &_m.Mock}
}
// WithContext provides a mock function with given fields: _a0
func (_m *MockWithContext) WithContext(_a0 context.Context) (context.Context, context.CancelFunc) {
ret := _m.Called(_a0)
if len(ret) == 0 {
panic("no return value specified for WithContext")
}
var r0 context.Context
var r1 context.CancelFunc
if rf, ok := ret.Get(0).(func(context.Context) (context.Context, context.CancelFunc)); ok {
return rf(_a0)
}
if rf, ok := ret.Get(0).(func(context.Context) context.Context); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(context.Context)
}
}
if rf, ok := ret.Get(1).(func(context.Context) context.CancelFunc); ok {
r1 = rf(_a0)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(context.CancelFunc)
}
}
return r0, r1
}
// MockWithContext_WithContext_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WithContext'
type MockWithContext_WithContext_Call struct {
*mock.Call
}
// WithContext is a helper method to define mock.On call
// - _a0 context.Context
func (_e *MockWithContext_Expecter) WithContext(_a0 interface{}) *MockWithContext_WithContext_Call {
return &MockWithContext_WithContext_Call{Call: _e.mock.On("WithContext", _a0)}
}
func (_c *MockWithContext_WithContext_Call) Run(run func(_a0 context.Context)) *MockWithContext_WithContext_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockWithContext_WithContext_Call) Return(_a0 context.Context, _a1 context.CancelFunc) *MockWithContext_WithContext_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockWithContext_WithContext_Call) RunAndReturn(run func(context.Context) (context.Context, context.CancelFunc)) *MockWithContext_WithContext_Call {
_c.Call.Return(run)
return _c
}
// NewMockWithContext creates a new instance of MockWithContext. 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 NewMockWithContext(t interface {
mock.TestingT
Cleanup(func())
}) *MockWithContext {
mock := &MockWithContext{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}