// Code generated by mockery; DO NOT EDIT. // github.com/vektra/mockery // template: testify package mocks import ( "context" "time" mock "github.com/stretchr/testify/mock" ) // NewMockCache creates a new instance of MockCache. 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 NewMockCache(t interface { mock.TestingT Cleanup(func()) }) *MockCache { if helper, ok := t.(interface{ Helper() }); ok { helper.Helper() } mock := &MockCache{} mock.Mock.Test(t) t.Cleanup(func() { if helper, ok := t.(interface{ Helper() }); ok { helper.Helper() } mock.AssertExpectations(t) }) return mock } // MockCache is an autogenerated mock type for the Cache type type MockCache struct { mock.Mock } type MockCache_Expecter struct { mock *mock.Mock } func (_m *MockCache) EXPECT() *MockCache_Expecter { return &MockCache_Expecter{mock: &_m.Mock} } // Close provides a mock function for the type MockCache func (_mock *MockCache) Close() error { ret := _mock.Called() if len(ret) == 0 { panic("no return value specified for Close") } var r0 error if returnFunc, ok := ret.Get(0).(func() error); ok { r0 = returnFunc() } else { r0 = ret.Error(0) } return r0 } // MockCache_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' type MockCache_Close_Call struct { *mock.Call } // Close is a helper method to define mock.On call func (_e *MockCache_Expecter) Close() *MockCache_Close_Call { return &MockCache_Close_Call{Call: _e.mock.On("Close")} } func (_c *MockCache_Close_Call) Run(run func()) *MockCache_Close_Call { _c.Call.Run(func(args mock.Arguments) { run() }) return _c } func (_c *MockCache_Close_Call) Return(err error) *MockCache_Close_Call { _c.Call.Return(err) return _c } func (_c *MockCache_Close_Call) RunAndReturn(run func() error) *MockCache_Close_Call { _c.Call.Return(run) return _c } // Delete provides a mock function for the type MockCache func (_mock *MockCache) Delete(ctx context.Context, keys ...string) error { var tmpRet mock.Arguments if len(keys) > 0 { tmpRet = _mock.Called(ctx, keys) } else { tmpRet = _mock.Called(ctx) } ret := tmpRet if len(ret) == 0 { panic("no return value specified for Delete") } var r0 error if returnFunc, ok := ret.Get(0).(func(context.Context, ...string) error); ok { r0 = returnFunc(ctx, keys...) } else { r0 = ret.Error(0) } return r0 } // MockCache_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' type MockCache_Delete_Call struct { *mock.Call } // Delete is a helper method to define mock.On call // - ctx context.Context // - keys ...string func (_e *MockCache_Expecter) Delete(ctx any, keys ...any) *MockCache_Delete_Call { return &MockCache_Delete_Call{Call: _e.mock.On("Delete", append([]any{ctx}, keys...)...)} } func (_c *MockCache_Delete_Call) Run(run func(ctx context.Context, keys ...string)) *MockCache_Delete_Call { _c.Call.Run(func(args mock.Arguments) { var arg0 context.Context if args[0] != nil { arg0 = args[0].(context.Context) } var arg1 []string var variadicArgs []string if len(args) > 1 { variadicArgs = args[1].([]string) } arg1 = variadicArgs run( arg0, arg1..., ) }) return _c } func (_c *MockCache_Delete_Call) Return(err error) *MockCache_Delete_Call { _c.Call.Return(err) return _c } func (_c *MockCache_Delete_Call) RunAndReturn(run func(ctx context.Context, keys ...string) error) *MockCache_Delete_Call { _c.Call.Return(run) return _c } // Get provides a mock function for the type MockCache func (_mock *MockCache) Get(ctx context.Context, key string) ([]byte, error) { ret := _mock.Called(ctx, key) if len(ret) == 0 { panic("no return value specified for Get") } var r0 []byte var r1 error if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]byte, error)); ok { return returnFunc(ctx, key) } if returnFunc, ok := ret.Get(0).(func(context.Context, string) []byte); ok { r0 = returnFunc(ctx, key) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]byte) } } if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok { r1 = returnFunc(ctx, key) } else { r1 = ret.Error(1) } return r0, r1 } // MockCache_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' type MockCache_Get_Call struct { *mock.Call } // Get is a helper method to define mock.On call // - ctx context.Context // - key string func (_e *MockCache_Expecter) Get(ctx any, key any) *MockCache_Get_Call { return &MockCache_Get_Call{Call: _e.mock.On("Get", ctx, key)} } func (_c *MockCache_Get_Call) Run(run func(ctx context.Context, key string)) *MockCache_Get_Call { _c.Call.Run(func(args mock.Arguments) { var arg0 context.Context if args[0] != nil { arg0 = args[0].(context.Context) } var arg1 string if args[1] != nil { arg1 = args[1].(string) } run( arg0, arg1, ) }) return _c } func (_c *MockCache_Get_Call) Return(bytes []byte, err error) *MockCache_Get_Call { _c.Call.Return(bytes, err) return _c } func (_c *MockCache_Get_Call) RunAndReturn(run func(ctx context.Context, key string) ([]byte, error)) *MockCache_Get_Call { _c.Call.Return(run) return _c } // Ping provides a mock function for the type MockCache func (_mock *MockCache) Ping(ctx context.Context) error { ret := _mock.Called(ctx) if len(ret) == 0 { panic("no return value specified for Ping") } var r0 error if returnFunc, ok := ret.Get(0).(func(context.Context) error); ok { r0 = returnFunc(ctx) } else { r0 = ret.Error(0) } return r0 } // MockCache_Ping_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ping' type MockCache_Ping_Call struct { *mock.Call } // Ping is a helper method to define mock.On call // - ctx context.Context func (_e *MockCache_Expecter) Ping(ctx any) *MockCache_Ping_Call { return &MockCache_Ping_Call{Call: _e.mock.On("Ping", ctx)} } func (_c *MockCache_Ping_Call) Run(run func(ctx context.Context)) *MockCache_Ping_Call { _c.Call.Run(func(args mock.Arguments) { var arg0 context.Context if args[0] != nil { arg0 = args[0].(context.Context) } run( arg0, ) }) return _c } func (_c *MockCache_Ping_Call) Return(err error) *MockCache_Ping_Call { _c.Call.Return(err) return _c } func (_c *MockCache_Ping_Call) RunAndReturn(run func(ctx context.Context) error) *MockCache_Ping_Call { _c.Call.Return(run) return _c } // Set provides a mock function for the type MockCache func (_mock *MockCache) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error { ret := _mock.Called(ctx, key, value, ttl) if len(ret) == 0 { panic("no return value specified for Set") } var r0 error if returnFunc, ok := ret.Get(0).(func(context.Context, string, []byte, time.Duration) error); ok { r0 = returnFunc(ctx, key, value, ttl) } else { r0 = ret.Error(0) } return r0 } // MockCache_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' type MockCache_Set_Call struct { *mock.Call } // Set is a helper method to define mock.On call // - ctx context.Context // - key string // - value []byte // - ttl time.Duration func (_e *MockCache_Expecter) Set(ctx any, key any, value any, ttl any) *MockCache_Set_Call { return &MockCache_Set_Call{Call: _e.mock.On("Set", ctx, key, value, ttl)} } func (_c *MockCache_Set_Call) Run(run func(ctx context.Context, key string, value []byte, ttl time.Duration)) *MockCache_Set_Call { _c.Call.Run(func(args mock.Arguments) { var arg0 context.Context if args[0] != nil { arg0 = args[0].(context.Context) } var arg1 string if args[1] != nil { arg1 = args[1].(string) } var arg2 []byte if args[2] != nil { arg2 = args[2].([]byte) } var arg3 time.Duration if args[3] != nil { arg3 = args[3].(time.Duration) } run( arg0, arg1, arg2, arg3, ) }) return _c } func (_c *MockCache_Set_Call) Return(err error) *MockCache_Set_Call { _c.Call.Return(err) return _c } func (_c *MockCache_Set_Call) RunAndReturn(run func(ctx context.Context, key string, value []byte, ttl time.Duration) error) *MockCache_Set_Call { _c.Call.Return(run) return _c }