Files
smart-search-back/internal/mocks/request_service_mock.go
vallyenfail 7e73144486
All checks were successful
Deploy Smart Search Backend Test / deploy (push) Successful in 1m44s
add service
2026-01-20 14:26:27 +03:00

1675 lines
73 KiB
Go

// Code generated by http://github.com/gojuno/minimock (v3.4.7). DO NOT EDIT.
package mocks
//go:generate minimock -i git.techease.ru/Smart-search/smart-search-back/internal/service.RequestService -o request_service_mock.go -n RequestServiceMock -p mocks
import (
"context"
"sync"
mm_atomic "sync/atomic"
mm_time "time"
"git.techease.ru/Smart-search/smart-search-back/internal/model"
"github.com/gojuno/minimock/v3"
"github.com/google/uuid"
)
// RequestServiceMock implements mm_service.RequestService
type RequestServiceMock struct {
t minimock.Tester
finishOnce sync.Once
funcApproveTZ func(ctx context.Context, requestID uuid.UUID, tzText string, userID int) (spa1 []*model.Supplier, err error)
funcApproveTZOrigin string
inspectFuncApproveTZ func(ctx context.Context, requestID uuid.UUID, tzText string, userID int)
afterApproveTZCounter uint64
beforeApproveTZCounter uint64
ApproveTZMock mRequestServiceMockApproveTZ
funcCreateTZ func(ctx context.Context, userID int, requestTxt string, fileData []byte, fileName string) (u1 uuid.UUID, s1 string, err error)
funcCreateTZOrigin string
inspectFuncCreateTZ func(ctx context.Context, userID int, requestTxt string, fileData []byte, fileName string)
afterCreateTZCounter uint64
beforeCreateTZCounter uint64
CreateTZMock mRequestServiceMockCreateTZ
funcGetMailingList func(ctx context.Context, userID int) (rpa1 []*model.Request, err error)
funcGetMailingListOrigin string
inspectFuncGetMailingList func(ctx context.Context, userID int)
afterGetMailingListCounter uint64
beforeGetMailingListCounter uint64
GetMailingListMock mRequestServiceMockGetMailingList
funcGetMailingListByID func(ctx context.Context, requestID uuid.UUID, userID int) (rp1 *model.RequestDetail, err error)
funcGetMailingListByIDOrigin string
inspectFuncGetMailingListByID func(ctx context.Context, requestID uuid.UUID, userID int)
afterGetMailingListByIDCounter uint64
beforeGetMailingListByIDCounter uint64
GetMailingListByIDMock mRequestServiceMockGetMailingListByID
}
// NewRequestServiceMock returns a mock for mm_service.RequestService
func NewRequestServiceMock(t minimock.Tester) *RequestServiceMock {
m := &RequestServiceMock{t: t}
if controller, ok := t.(minimock.MockController); ok {
controller.RegisterMocker(m)
}
m.ApproveTZMock = mRequestServiceMockApproveTZ{mock: m}
m.ApproveTZMock.callArgs = []*RequestServiceMockApproveTZParams{}
m.CreateTZMock = mRequestServiceMockCreateTZ{mock: m}
m.CreateTZMock.callArgs = []*RequestServiceMockCreateTZParams{}
m.GetMailingListMock = mRequestServiceMockGetMailingList{mock: m}
m.GetMailingListMock.callArgs = []*RequestServiceMockGetMailingListParams{}
m.GetMailingListByIDMock = mRequestServiceMockGetMailingListByID{mock: m}
m.GetMailingListByIDMock.callArgs = []*RequestServiceMockGetMailingListByIDParams{}
t.Cleanup(m.MinimockFinish)
return m
}
type mRequestServiceMockApproveTZ struct {
optional bool
mock *RequestServiceMock
defaultExpectation *RequestServiceMockApproveTZExpectation
expectations []*RequestServiceMockApproveTZExpectation
callArgs []*RequestServiceMockApproveTZParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestServiceMockApproveTZExpectation specifies expectation struct of the RequestService.ApproveTZ
type RequestServiceMockApproveTZExpectation struct {
mock *RequestServiceMock
params *RequestServiceMockApproveTZParams
paramPtrs *RequestServiceMockApproveTZParamPtrs
expectationOrigins RequestServiceMockApproveTZExpectationOrigins
results *RequestServiceMockApproveTZResults
returnOrigin string
Counter uint64
}
// RequestServiceMockApproveTZParams contains parameters of the RequestService.ApproveTZ
type RequestServiceMockApproveTZParams struct {
ctx context.Context
requestID uuid.UUID
tzText string
userID int
}
// RequestServiceMockApproveTZParamPtrs contains pointers to parameters of the RequestService.ApproveTZ
type RequestServiceMockApproveTZParamPtrs struct {
ctx *context.Context
requestID *uuid.UUID
tzText *string
userID *int
}
// RequestServiceMockApproveTZResults contains results of the RequestService.ApproveTZ
type RequestServiceMockApproveTZResults struct {
spa1 []*model.Supplier
err error
}
// RequestServiceMockApproveTZOrigins contains origins of expectations of the RequestService.ApproveTZ
type RequestServiceMockApproveTZExpectationOrigins struct {
origin string
originCtx string
originRequestID string
originTzText string
originUserID string
}
// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
// Optional() makes method check to work in '0 or more' mode.
// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
// catch the problems when the expected method call is totally skipped during test run.
func (mmApproveTZ *mRequestServiceMockApproveTZ) Optional() *mRequestServiceMockApproveTZ {
mmApproveTZ.optional = true
return mmApproveTZ
}
// Expect sets up expected params for RequestService.ApproveTZ
func (mmApproveTZ *mRequestServiceMockApproveTZ) Expect(ctx context.Context, requestID uuid.UUID, tzText string, userID int) *mRequestServiceMockApproveTZ {
if mmApproveTZ.mock.funcApproveTZ != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Set")
}
if mmApproveTZ.defaultExpectation == nil {
mmApproveTZ.defaultExpectation = &RequestServiceMockApproveTZExpectation{}
}
if mmApproveTZ.defaultExpectation.paramPtrs != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by ExpectParams functions")
}
mmApproveTZ.defaultExpectation.params = &RequestServiceMockApproveTZParams{ctx, requestID, tzText, userID}
mmApproveTZ.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmApproveTZ.expectations {
if minimock.Equal(e.params, mmApproveTZ.defaultExpectation.params) {
mmApproveTZ.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmApproveTZ.defaultExpectation.params)
}
}
return mmApproveTZ
}
// ExpectCtxParam1 sets up expected param ctx for RequestService.ApproveTZ
func (mmApproveTZ *mRequestServiceMockApproveTZ) ExpectCtxParam1(ctx context.Context) *mRequestServiceMockApproveTZ {
if mmApproveTZ.mock.funcApproveTZ != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Set")
}
if mmApproveTZ.defaultExpectation == nil {
mmApproveTZ.defaultExpectation = &RequestServiceMockApproveTZExpectation{}
}
if mmApproveTZ.defaultExpectation.params != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Expect")
}
if mmApproveTZ.defaultExpectation.paramPtrs == nil {
mmApproveTZ.defaultExpectation.paramPtrs = &RequestServiceMockApproveTZParamPtrs{}
}
mmApproveTZ.defaultExpectation.paramPtrs.ctx = &ctx
mmApproveTZ.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmApproveTZ
}
// ExpectRequestIDParam2 sets up expected param requestID for RequestService.ApproveTZ
func (mmApproveTZ *mRequestServiceMockApproveTZ) ExpectRequestIDParam2(requestID uuid.UUID) *mRequestServiceMockApproveTZ {
if mmApproveTZ.mock.funcApproveTZ != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Set")
}
if mmApproveTZ.defaultExpectation == nil {
mmApproveTZ.defaultExpectation = &RequestServiceMockApproveTZExpectation{}
}
if mmApproveTZ.defaultExpectation.params != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Expect")
}
if mmApproveTZ.defaultExpectation.paramPtrs == nil {
mmApproveTZ.defaultExpectation.paramPtrs = &RequestServiceMockApproveTZParamPtrs{}
}
mmApproveTZ.defaultExpectation.paramPtrs.requestID = &requestID
mmApproveTZ.defaultExpectation.expectationOrigins.originRequestID = minimock.CallerInfo(1)
return mmApproveTZ
}
// ExpectTzTextParam3 sets up expected param tzText for RequestService.ApproveTZ
func (mmApproveTZ *mRequestServiceMockApproveTZ) ExpectTzTextParam3(tzText string) *mRequestServiceMockApproveTZ {
if mmApproveTZ.mock.funcApproveTZ != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Set")
}
if mmApproveTZ.defaultExpectation == nil {
mmApproveTZ.defaultExpectation = &RequestServiceMockApproveTZExpectation{}
}
if mmApproveTZ.defaultExpectation.params != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Expect")
}
if mmApproveTZ.defaultExpectation.paramPtrs == nil {
mmApproveTZ.defaultExpectation.paramPtrs = &RequestServiceMockApproveTZParamPtrs{}
}
mmApproveTZ.defaultExpectation.paramPtrs.tzText = &tzText
mmApproveTZ.defaultExpectation.expectationOrigins.originTzText = minimock.CallerInfo(1)
return mmApproveTZ
}
// ExpectUserIDParam4 sets up expected param userID for RequestService.ApproveTZ
func (mmApproveTZ *mRequestServiceMockApproveTZ) ExpectUserIDParam4(userID int) *mRequestServiceMockApproveTZ {
if mmApproveTZ.mock.funcApproveTZ != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Set")
}
if mmApproveTZ.defaultExpectation == nil {
mmApproveTZ.defaultExpectation = &RequestServiceMockApproveTZExpectation{}
}
if mmApproveTZ.defaultExpectation.params != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Expect")
}
if mmApproveTZ.defaultExpectation.paramPtrs == nil {
mmApproveTZ.defaultExpectation.paramPtrs = &RequestServiceMockApproveTZParamPtrs{}
}
mmApproveTZ.defaultExpectation.paramPtrs.userID = &userID
mmApproveTZ.defaultExpectation.expectationOrigins.originUserID = minimock.CallerInfo(1)
return mmApproveTZ
}
// Inspect accepts an inspector function that has same arguments as the RequestService.ApproveTZ
func (mmApproveTZ *mRequestServiceMockApproveTZ) Inspect(f func(ctx context.Context, requestID uuid.UUID, tzText string, userID int)) *mRequestServiceMockApproveTZ {
if mmApproveTZ.mock.inspectFuncApproveTZ != nil {
mmApproveTZ.mock.t.Fatalf("Inspect function is already set for RequestServiceMock.ApproveTZ")
}
mmApproveTZ.mock.inspectFuncApproveTZ = f
return mmApproveTZ
}
// Return sets up results that will be returned by RequestService.ApproveTZ
func (mmApproveTZ *mRequestServiceMockApproveTZ) Return(spa1 []*model.Supplier, err error) *RequestServiceMock {
if mmApproveTZ.mock.funcApproveTZ != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Set")
}
if mmApproveTZ.defaultExpectation == nil {
mmApproveTZ.defaultExpectation = &RequestServiceMockApproveTZExpectation{mock: mmApproveTZ.mock}
}
mmApproveTZ.defaultExpectation.results = &RequestServiceMockApproveTZResults{spa1, err}
mmApproveTZ.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmApproveTZ.mock
}
// Set uses given function f to mock the RequestService.ApproveTZ method
func (mmApproveTZ *mRequestServiceMockApproveTZ) Set(f func(ctx context.Context, requestID uuid.UUID, tzText string, userID int) (spa1 []*model.Supplier, err error)) *RequestServiceMock {
if mmApproveTZ.defaultExpectation != nil {
mmApproveTZ.mock.t.Fatalf("Default expectation is already set for the RequestService.ApproveTZ method")
}
if len(mmApproveTZ.expectations) > 0 {
mmApproveTZ.mock.t.Fatalf("Some expectations are already set for the RequestService.ApproveTZ method")
}
mmApproveTZ.mock.funcApproveTZ = f
mmApproveTZ.mock.funcApproveTZOrigin = minimock.CallerInfo(1)
return mmApproveTZ.mock
}
// When sets expectation for the RequestService.ApproveTZ which will trigger the result defined by the following
// Then helper
func (mmApproveTZ *mRequestServiceMockApproveTZ) When(ctx context.Context, requestID uuid.UUID, tzText string, userID int) *RequestServiceMockApproveTZExpectation {
if mmApproveTZ.mock.funcApproveTZ != nil {
mmApproveTZ.mock.t.Fatalf("RequestServiceMock.ApproveTZ mock is already set by Set")
}
expectation := &RequestServiceMockApproveTZExpectation{
mock: mmApproveTZ.mock,
params: &RequestServiceMockApproveTZParams{ctx, requestID, tzText, userID},
expectationOrigins: RequestServiceMockApproveTZExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmApproveTZ.expectations = append(mmApproveTZ.expectations, expectation)
return expectation
}
// Then sets up RequestService.ApproveTZ return parameters for the expectation previously defined by the When method
func (e *RequestServiceMockApproveTZExpectation) Then(spa1 []*model.Supplier, err error) *RequestServiceMock {
e.results = &RequestServiceMockApproveTZResults{spa1, err}
return e.mock
}
// Times sets number of times RequestService.ApproveTZ should be invoked
func (mmApproveTZ *mRequestServiceMockApproveTZ) Times(n uint64) *mRequestServiceMockApproveTZ {
if n == 0 {
mmApproveTZ.mock.t.Fatalf("Times of RequestServiceMock.ApproveTZ mock can not be zero")
}
mm_atomic.StoreUint64(&mmApproveTZ.expectedInvocations, n)
mmApproveTZ.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmApproveTZ
}
func (mmApproveTZ *mRequestServiceMockApproveTZ) invocationsDone() bool {
if len(mmApproveTZ.expectations) == 0 && mmApproveTZ.defaultExpectation == nil && mmApproveTZ.mock.funcApproveTZ == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmApproveTZ.mock.afterApproveTZCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmApproveTZ.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// ApproveTZ implements mm_service.RequestService
func (mmApproveTZ *RequestServiceMock) ApproveTZ(ctx context.Context, requestID uuid.UUID, tzText string, userID int) (spa1 []*model.Supplier, err error) {
mm_atomic.AddUint64(&mmApproveTZ.beforeApproveTZCounter, 1)
defer mm_atomic.AddUint64(&mmApproveTZ.afterApproveTZCounter, 1)
mmApproveTZ.t.Helper()
if mmApproveTZ.inspectFuncApproveTZ != nil {
mmApproveTZ.inspectFuncApproveTZ(ctx, requestID, tzText, userID)
}
mm_params := RequestServiceMockApproveTZParams{ctx, requestID, tzText, userID}
// Record call args
mmApproveTZ.ApproveTZMock.mutex.Lock()
mmApproveTZ.ApproveTZMock.callArgs = append(mmApproveTZ.ApproveTZMock.callArgs, &mm_params)
mmApproveTZ.ApproveTZMock.mutex.Unlock()
for _, e := range mmApproveTZ.ApproveTZMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.spa1, e.results.err
}
}
if mmApproveTZ.ApproveTZMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmApproveTZ.ApproveTZMock.defaultExpectation.Counter, 1)
mm_want := mmApproveTZ.ApproveTZMock.defaultExpectation.params
mm_want_ptrs := mmApproveTZ.ApproveTZMock.defaultExpectation.paramPtrs
mm_got := RequestServiceMockApproveTZParams{ctx, requestID, tzText, userID}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmApproveTZ.t.Errorf("RequestServiceMock.ApproveTZ got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApproveTZ.ApproveTZMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.requestID != nil && !minimock.Equal(*mm_want_ptrs.requestID, mm_got.requestID) {
mmApproveTZ.t.Errorf("RequestServiceMock.ApproveTZ got unexpected parameter requestID, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApproveTZ.ApproveTZMock.defaultExpectation.expectationOrigins.originRequestID, *mm_want_ptrs.requestID, mm_got.requestID, minimock.Diff(*mm_want_ptrs.requestID, mm_got.requestID))
}
if mm_want_ptrs.tzText != nil && !minimock.Equal(*mm_want_ptrs.tzText, mm_got.tzText) {
mmApproveTZ.t.Errorf("RequestServiceMock.ApproveTZ got unexpected parameter tzText, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApproveTZ.ApproveTZMock.defaultExpectation.expectationOrigins.originTzText, *mm_want_ptrs.tzText, mm_got.tzText, minimock.Diff(*mm_want_ptrs.tzText, mm_got.tzText))
}
if mm_want_ptrs.userID != nil && !minimock.Equal(*mm_want_ptrs.userID, mm_got.userID) {
mmApproveTZ.t.Errorf("RequestServiceMock.ApproveTZ got unexpected parameter userID, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApproveTZ.ApproveTZMock.defaultExpectation.expectationOrigins.originUserID, *mm_want_ptrs.userID, mm_got.userID, minimock.Diff(*mm_want_ptrs.userID, mm_got.userID))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmApproveTZ.t.Errorf("RequestServiceMock.ApproveTZ got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmApproveTZ.ApproveTZMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmApproveTZ.ApproveTZMock.defaultExpectation.results
if mm_results == nil {
mmApproveTZ.t.Fatal("No results are set for the RequestServiceMock.ApproveTZ")
}
return (*mm_results).spa1, (*mm_results).err
}
if mmApproveTZ.funcApproveTZ != nil {
return mmApproveTZ.funcApproveTZ(ctx, requestID, tzText, userID)
}
mmApproveTZ.t.Fatalf("Unexpected call to RequestServiceMock.ApproveTZ. %v %v %v %v", ctx, requestID, tzText, userID)
return
}
// ApproveTZAfterCounter returns a count of finished RequestServiceMock.ApproveTZ invocations
func (mmApproveTZ *RequestServiceMock) ApproveTZAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmApproveTZ.afterApproveTZCounter)
}
// ApproveTZBeforeCounter returns a count of RequestServiceMock.ApproveTZ invocations
func (mmApproveTZ *RequestServiceMock) ApproveTZBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmApproveTZ.beforeApproveTZCounter)
}
// Calls returns a list of arguments used in each call to RequestServiceMock.ApproveTZ.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmApproveTZ *mRequestServiceMockApproveTZ) Calls() []*RequestServiceMockApproveTZParams {
mmApproveTZ.mutex.RLock()
argCopy := make([]*RequestServiceMockApproveTZParams, len(mmApproveTZ.callArgs))
copy(argCopy, mmApproveTZ.callArgs)
mmApproveTZ.mutex.RUnlock()
return argCopy
}
// MinimockApproveTZDone returns true if the count of the ApproveTZ invocations corresponds
// the number of defined expectations
func (m *RequestServiceMock) MinimockApproveTZDone() bool {
if m.ApproveTZMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.ApproveTZMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.ApproveTZMock.invocationsDone()
}
// MinimockApproveTZInspect logs each unmet expectation
func (m *RequestServiceMock) MinimockApproveTZInspect() {
for _, e := range m.ApproveTZMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestServiceMock.ApproveTZ at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterApproveTZCounter := mm_atomic.LoadUint64(&m.afterApproveTZCounter)
// if default expectation was set then invocations count should be greater than zero
if m.ApproveTZMock.defaultExpectation != nil && afterApproveTZCounter < 1 {
if m.ApproveTZMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestServiceMock.ApproveTZ at\n%s", m.ApproveTZMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestServiceMock.ApproveTZ at\n%s with params: %#v", m.ApproveTZMock.defaultExpectation.expectationOrigins.origin, *m.ApproveTZMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcApproveTZ != nil && afterApproveTZCounter < 1 {
m.t.Errorf("Expected call to RequestServiceMock.ApproveTZ at\n%s", m.funcApproveTZOrigin)
}
if !m.ApproveTZMock.invocationsDone() && afterApproveTZCounter > 0 {
m.t.Errorf("Expected %d calls to RequestServiceMock.ApproveTZ at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.ApproveTZMock.expectedInvocations), m.ApproveTZMock.expectedInvocationsOrigin, afterApproveTZCounter)
}
}
type mRequestServiceMockCreateTZ struct {
optional bool
mock *RequestServiceMock
defaultExpectation *RequestServiceMockCreateTZExpectation
expectations []*RequestServiceMockCreateTZExpectation
callArgs []*RequestServiceMockCreateTZParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestServiceMockCreateTZExpectation specifies expectation struct of the RequestService.CreateTZ
type RequestServiceMockCreateTZExpectation struct {
mock *RequestServiceMock
params *RequestServiceMockCreateTZParams
paramPtrs *RequestServiceMockCreateTZParamPtrs
expectationOrigins RequestServiceMockCreateTZExpectationOrigins
results *RequestServiceMockCreateTZResults
returnOrigin string
Counter uint64
}
// RequestServiceMockCreateTZParams contains parameters of the RequestService.CreateTZ
type RequestServiceMockCreateTZParams struct {
ctx context.Context
userID int
requestTxt string
fileData []byte
fileName string
}
// RequestServiceMockCreateTZParamPtrs contains pointers to parameters of the RequestService.CreateTZ
type RequestServiceMockCreateTZParamPtrs struct {
ctx *context.Context
userID *int
requestTxt *string
fileData *[]byte
fileName *string
}
// RequestServiceMockCreateTZResults contains results of the RequestService.CreateTZ
type RequestServiceMockCreateTZResults struct {
u1 uuid.UUID
s1 string
err error
}
// RequestServiceMockCreateTZOrigins contains origins of expectations of the RequestService.CreateTZ
type RequestServiceMockCreateTZExpectationOrigins struct {
origin string
originCtx string
originUserID string
originRequestTxt string
originFileData string
originFileName string
}
// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
// Optional() makes method check to work in '0 or more' mode.
// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
// catch the problems when the expected method call is totally skipped during test run.
func (mmCreateTZ *mRequestServiceMockCreateTZ) Optional() *mRequestServiceMockCreateTZ {
mmCreateTZ.optional = true
return mmCreateTZ
}
// Expect sets up expected params for RequestService.CreateTZ
func (mmCreateTZ *mRequestServiceMockCreateTZ) Expect(ctx context.Context, userID int, requestTxt string, fileData []byte, fileName string) *mRequestServiceMockCreateTZ {
if mmCreateTZ.mock.funcCreateTZ != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Set")
}
if mmCreateTZ.defaultExpectation == nil {
mmCreateTZ.defaultExpectation = &RequestServiceMockCreateTZExpectation{}
}
if mmCreateTZ.defaultExpectation.paramPtrs != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by ExpectParams functions")
}
mmCreateTZ.defaultExpectation.params = &RequestServiceMockCreateTZParams{ctx, userID, requestTxt, fileData, fileName}
mmCreateTZ.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmCreateTZ.expectations {
if minimock.Equal(e.params, mmCreateTZ.defaultExpectation.params) {
mmCreateTZ.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCreateTZ.defaultExpectation.params)
}
}
return mmCreateTZ
}
// ExpectCtxParam1 sets up expected param ctx for RequestService.CreateTZ
func (mmCreateTZ *mRequestServiceMockCreateTZ) ExpectCtxParam1(ctx context.Context) *mRequestServiceMockCreateTZ {
if mmCreateTZ.mock.funcCreateTZ != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Set")
}
if mmCreateTZ.defaultExpectation == nil {
mmCreateTZ.defaultExpectation = &RequestServiceMockCreateTZExpectation{}
}
if mmCreateTZ.defaultExpectation.params != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Expect")
}
if mmCreateTZ.defaultExpectation.paramPtrs == nil {
mmCreateTZ.defaultExpectation.paramPtrs = &RequestServiceMockCreateTZParamPtrs{}
}
mmCreateTZ.defaultExpectation.paramPtrs.ctx = &ctx
mmCreateTZ.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmCreateTZ
}
// ExpectUserIDParam2 sets up expected param userID for RequestService.CreateTZ
func (mmCreateTZ *mRequestServiceMockCreateTZ) ExpectUserIDParam2(userID int) *mRequestServiceMockCreateTZ {
if mmCreateTZ.mock.funcCreateTZ != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Set")
}
if mmCreateTZ.defaultExpectation == nil {
mmCreateTZ.defaultExpectation = &RequestServiceMockCreateTZExpectation{}
}
if mmCreateTZ.defaultExpectation.params != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Expect")
}
if mmCreateTZ.defaultExpectation.paramPtrs == nil {
mmCreateTZ.defaultExpectation.paramPtrs = &RequestServiceMockCreateTZParamPtrs{}
}
mmCreateTZ.defaultExpectation.paramPtrs.userID = &userID
mmCreateTZ.defaultExpectation.expectationOrigins.originUserID = minimock.CallerInfo(1)
return mmCreateTZ
}
// ExpectRequestTxtParam3 sets up expected param requestTxt for RequestService.CreateTZ
func (mmCreateTZ *mRequestServiceMockCreateTZ) ExpectRequestTxtParam3(requestTxt string) *mRequestServiceMockCreateTZ {
if mmCreateTZ.mock.funcCreateTZ != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Set")
}
if mmCreateTZ.defaultExpectation == nil {
mmCreateTZ.defaultExpectation = &RequestServiceMockCreateTZExpectation{}
}
if mmCreateTZ.defaultExpectation.params != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Expect")
}
if mmCreateTZ.defaultExpectation.paramPtrs == nil {
mmCreateTZ.defaultExpectation.paramPtrs = &RequestServiceMockCreateTZParamPtrs{}
}
mmCreateTZ.defaultExpectation.paramPtrs.requestTxt = &requestTxt
mmCreateTZ.defaultExpectation.expectationOrigins.originRequestTxt = minimock.CallerInfo(1)
return mmCreateTZ
}
// ExpectFileDataParam4 sets up expected param fileData for RequestService.CreateTZ
func (mmCreateTZ *mRequestServiceMockCreateTZ) ExpectFileDataParam4(fileData []byte) *mRequestServiceMockCreateTZ {
if mmCreateTZ.mock.funcCreateTZ != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Set")
}
if mmCreateTZ.defaultExpectation == nil {
mmCreateTZ.defaultExpectation = &RequestServiceMockCreateTZExpectation{}
}
if mmCreateTZ.defaultExpectation.params != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Expect")
}
if mmCreateTZ.defaultExpectation.paramPtrs == nil {
mmCreateTZ.defaultExpectation.paramPtrs = &RequestServiceMockCreateTZParamPtrs{}
}
mmCreateTZ.defaultExpectation.paramPtrs.fileData = &fileData
mmCreateTZ.defaultExpectation.expectationOrigins.originFileData = minimock.CallerInfo(1)
return mmCreateTZ
}
// ExpectFileNameParam5 sets up expected param fileName for RequestService.CreateTZ
func (mmCreateTZ *mRequestServiceMockCreateTZ) ExpectFileNameParam5(fileName string) *mRequestServiceMockCreateTZ {
if mmCreateTZ.mock.funcCreateTZ != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Set")
}
if mmCreateTZ.defaultExpectation == nil {
mmCreateTZ.defaultExpectation = &RequestServiceMockCreateTZExpectation{}
}
if mmCreateTZ.defaultExpectation.params != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Expect")
}
if mmCreateTZ.defaultExpectation.paramPtrs == nil {
mmCreateTZ.defaultExpectation.paramPtrs = &RequestServiceMockCreateTZParamPtrs{}
}
mmCreateTZ.defaultExpectation.paramPtrs.fileName = &fileName
mmCreateTZ.defaultExpectation.expectationOrigins.originFileName = minimock.CallerInfo(1)
return mmCreateTZ
}
// Inspect accepts an inspector function that has same arguments as the RequestService.CreateTZ
func (mmCreateTZ *mRequestServiceMockCreateTZ) Inspect(f func(ctx context.Context, userID int, requestTxt string, fileData []byte, fileName string)) *mRequestServiceMockCreateTZ {
if mmCreateTZ.mock.inspectFuncCreateTZ != nil {
mmCreateTZ.mock.t.Fatalf("Inspect function is already set for RequestServiceMock.CreateTZ")
}
mmCreateTZ.mock.inspectFuncCreateTZ = f
return mmCreateTZ
}
// Return sets up results that will be returned by RequestService.CreateTZ
func (mmCreateTZ *mRequestServiceMockCreateTZ) Return(u1 uuid.UUID, s1 string, err error) *RequestServiceMock {
if mmCreateTZ.mock.funcCreateTZ != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Set")
}
if mmCreateTZ.defaultExpectation == nil {
mmCreateTZ.defaultExpectation = &RequestServiceMockCreateTZExpectation{mock: mmCreateTZ.mock}
}
mmCreateTZ.defaultExpectation.results = &RequestServiceMockCreateTZResults{u1, s1, err}
mmCreateTZ.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmCreateTZ.mock
}
// Set uses given function f to mock the RequestService.CreateTZ method
func (mmCreateTZ *mRequestServiceMockCreateTZ) Set(f func(ctx context.Context, userID int, requestTxt string, fileData []byte, fileName string) (u1 uuid.UUID, s1 string, err error)) *RequestServiceMock {
if mmCreateTZ.defaultExpectation != nil {
mmCreateTZ.mock.t.Fatalf("Default expectation is already set for the RequestService.CreateTZ method")
}
if len(mmCreateTZ.expectations) > 0 {
mmCreateTZ.mock.t.Fatalf("Some expectations are already set for the RequestService.CreateTZ method")
}
mmCreateTZ.mock.funcCreateTZ = f
mmCreateTZ.mock.funcCreateTZOrigin = minimock.CallerInfo(1)
return mmCreateTZ.mock
}
// When sets expectation for the RequestService.CreateTZ which will trigger the result defined by the following
// Then helper
func (mmCreateTZ *mRequestServiceMockCreateTZ) When(ctx context.Context, userID int, requestTxt string, fileData []byte, fileName string) *RequestServiceMockCreateTZExpectation {
if mmCreateTZ.mock.funcCreateTZ != nil {
mmCreateTZ.mock.t.Fatalf("RequestServiceMock.CreateTZ mock is already set by Set")
}
expectation := &RequestServiceMockCreateTZExpectation{
mock: mmCreateTZ.mock,
params: &RequestServiceMockCreateTZParams{ctx, userID, requestTxt, fileData, fileName},
expectationOrigins: RequestServiceMockCreateTZExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmCreateTZ.expectations = append(mmCreateTZ.expectations, expectation)
return expectation
}
// Then sets up RequestService.CreateTZ return parameters for the expectation previously defined by the When method
func (e *RequestServiceMockCreateTZExpectation) Then(u1 uuid.UUID, s1 string, err error) *RequestServiceMock {
e.results = &RequestServiceMockCreateTZResults{u1, s1, err}
return e.mock
}
// Times sets number of times RequestService.CreateTZ should be invoked
func (mmCreateTZ *mRequestServiceMockCreateTZ) Times(n uint64) *mRequestServiceMockCreateTZ {
if n == 0 {
mmCreateTZ.mock.t.Fatalf("Times of RequestServiceMock.CreateTZ mock can not be zero")
}
mm_atomic.StoreUint64(&mmCreateTZ.expectedInvocations, n)
mmCreateTZ.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmCreateTZ
}
func (mmCreateTZ *mRequestServiceMockCreateTZ) invocationsDone() bool {
if len(mmCreateTZ.expectations) == 0 && mmCreateTZ.defaultExpectation == nil && mmCreateTZ.mock.funcCreateTZ == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmCreateTZ.mock.afterCreateTZCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmCreateTZ.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// CreateTZ implements mm_service.RequestService
func (mmCreateTZ *RequestServiceMock) CreateTZ(ctx context.Context, userID int, requestTxt string, fileData []byte, fileName string) (u1 uuid.UUID, s1 string, err error) {
mm_atomic.AddUint64(&mmCreateTZ.beforeCreateTZCounter, 1)
defer mm_atomic.AddUint64(&mmCreateTZ.afterCreateTZCounter, 1)
mmCreateTZ.t.Helper()
if mmCreateTZ.inspectFuncCreateTZ != nil {
mmCreateTZ.inspectFuncCreateTZ(ctx, userID, requestTxt, fileData, fileName)
}
mm_params := RequestServiceMockCreateTZParams{ctx, userID, requestTxt, fileData, fileName}
// Record call args
mmCreateTZ.CreateTZMock.mutex.Lock()
mmCreateTZ.CreateTZMock.callArgs = append(mmCreateTZ.CreateTZMock.callArgs, &mm_params)
mmCreateTZ.CreateTZMock.mutex.Unlock()
for _, e := range mmCreateTZ.CreateTZMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.u1, e.results.s1, e.results.err
}
}
if mmCreateTZ.CreateTZMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmCreateTZ.CreateTZMock.defaultExpectation.Counter, 1)
mm_want := mmCreateTZ.CreateTZMock.defaultExpectation.params
mm_want_ptrs := mmCreateTZ.CreateTZMock.defaultExpectation.paramPtrs
mm_got := RequestServiceMockCreateTZParams{ctx, userID, requestTxt, fileData, fileName}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmCreateTZ.t.Errorf("RequestServiceMock.CreateTZ got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCreateTZ.CreateTZMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.userID != nil && !minimock.Equal(*mm_want_ptrs.userID, mm_got.userID) {
mmCreateTZ.t.Errorf("RequestServiceMock.CreateTZ got unexpected parameter userID, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCreateTZ.CreateTZMock.defaultExpectation.expectationOrigins.originUserID, *mm_want_ptrs.userID, mm_got.userID, minimock.Diff(*mm_want_ptrs.userID, mm_got.userID))
}
if mm_want_ptrs.requestTxt != nil && !minimock.Equal(*mm_want_ptrs.requestTxt, mm_got.requestTxt) {
mmCreateTZ.t.Errorf("RequestServiceMock.CreateTZ got unexpected parameter requestTxt, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCreateTZ.CreateTZMock.defaultExpectation.expectationOrigins.originRequestTxt, *mm_want_ptrs.requestTxt, mm_got.requestTxt, minimock.Diff(*mm_want_ptrs.requestTxt, mm_got.requestTxt))
}
if mm_want_ptrs.fileData != nil && !minimock.Equal(*mm_want_ptrs.fileData, mm_got.fileData) {
mmCreateTZ.t.Errorf("RequestServiceMock.CreateTZ got unexpected parameter fileData, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCreateTZ.CreateTZMock.defaultExpectation.expectationOrigins.originFileData, *mm_want_ptrs.fileData, mm_got.fileData, minimock.Diff(*mm_want_ptrs.fileData, mm_got.fileData))
}
if mm_want_ptrs.fileName != nil && !minimock.Equal(*mm_want_ptrs.fileName, mm_got.fileName) {
mmCreateTZ.t.Errorf("RequestServiceMock.CreateTZ got unexpected parameter fileName, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCreateTZ.CreateTZMock.defaultExpectation.expectationOrigins.originFileName, *mm_want_ptrs.fileName, mm_got.fileName, minimock.Diff(*mm_want_ptrs.fileName, mm_got.fileName))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmCreateTZ.t.Errorf("RequestServiceMock.CreateTZ got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCreateTZ.CreateTZMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmCreateTZ.CreateTZMock.defaultExpectation.results
if mm_results == nil {
mmCreateTZ.t.Fatal("No results are set for the RequestServiceMock.CreateTZ")
}
return (*mm_results).u1, (*mm_results).s1, (*mm_results).err
}
if mmCreateTZ.funcCreateTZ != nil {
return mmCreateTZ.funcCreateTZ(ctx, userID, requestTxt, fileData, fileName)
}
mmCreateTZ.t.Fatalf("Unexpected call to RequestServiceMock.CreateTZ. %v %v %v %v %v", ctx, userID, requestTxt, fileData, fileName)
return
}
// CreateTZAfterCounter returns a count of finished RequestServiceMock.CreateTZ invocations
func (mmCreateTZ *RequestServiceMock) CreateTZAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmCreateTZ.afterCreateTZCounter)
}
// CreateTZBeforeCounter returns a count of RequestServiceMock.CreateTZ invocations
func (mmCreateTZ *RequestServiceMock) CreateTZBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmCreateTZ.beforeCreateTZCounter)
}
// Calls returns a list of arguments used in each call to RequestServiceMock.CreateTZ.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmCreateTZ *mRequestServiceMockCreateTZ) Calls() []*RequestServiceMockCreateTZParams {
mmCreateTZ.mutex.RLock()
argCopy := make([]*RequestServiceMockCreateTZParams, len(mmCreateTZ.callArgs))
copy(argCopy, mmCreateTZ.callArgs)
mmCreateTZ.mutex.RUnlock()
return argCopy
}
// MinimockCreateTZDone returns true if the count of the CreateTZ invocations corresponds
// the number of defined expectations
func (m *RequestServiceMock) MinimockCreateTZDone() bool {
if m.CreateTZMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.CreateTZMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.CreateTZMock.invocationsDone()
}
// MinimockCreateTZInspect logs each unmet expectation
func (m *RequestServiceMock) MinimockCreateTZInspect() {
for _, e := range m.CreateTZMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestServiceMock.CreateTZ at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterCreateTZCounter := mm_atomic.LoadUint64(&m.afterCreateTZCounter)
// if default expectation was set then invocations count should be greater than zero
if m.CreateTZMock.defaultExpectation != nil && afterCreateTZCounter < 1 {
if m.CreateTZMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestServiceMock.CreateTZ at\n%s", m.CreateTZMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestServiceMock.CreateTZ at\n%s with params: %#v", m.CreateTZMock.defaultExpectation.expectationOrigins.origin, *m.CreateTZMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcCreateTZ != nil && afterCreateTZCounter < 1 {
m.t.Errorf("Expected call to RequestServiceMock.CreateTZ at\n%s", m.funcCreateTZOrigin)
}
if !m.CreateTZMock.invocationsDone() && afterCreateTZCounter > 0 {
m.t.Errorf("Expected %d calls to RequestServiceMock.CreateTZ at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.CreateTZMock.expectedInvocations), m.CreateTZMock.expectedInvocationsOrigin, afterCreateTZCounter)
}
}
type mRequestServiceMockGetMailingList struct {
optional bool
mock *RequestServiceMock
defaultExpectation *RequestServiceMockGetMailingListExpectation
expectations []*RequestServiceMockGetMailingListExpectation
callArgs []*RequestServiceMockGetMailingListParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestServiceMockGetMailingListExpectation specifies expectation struct of the RequestService.GetMailingList
type RequestServiceMockGetMailingListExpectation struct {
mock *RequestServiceMock
params *RequestServiceMockGetMailingListParams
paramPtrs *RequestServiceMockGetMailingListParamPtrs
expectationOrigins RequestServiceMockGetMailingListExpectationOrigins
results *RequestServiceMockGetMailingListResults
returnOrigin string
Counter uint64
}
// RequestServiceMockGetMailingListParams contains parameters of the RequestService.GetMailingList
type RequestServiceMockGetMailingListParams struct {
ctx context.Context
userID int
}
// RequestServiceMockGetMailingListParamPtrs contains pointers to parameters of the RequestService.GetMailingList
type RequestServiceMockGetMailingListParamPtrs struct {
ctx *context.Context
userID *int
}
// RequestServiceMockGetMailingListResults contains results of the RequestService.GetMailingList
type RequestServiceMockGetMailingListResults struct {
rpa1 []*model.Request
err error
}
// RequestServiceMockGetMailingListOrigins contains origins of expectations of the RequestService.GetMailingList
type RequestServiceMockGetMailingListExpectationOrigins struct {
origin string
originCtx string
originUserID string
}
// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
// Optional() makes method check to work in '0 or more' mode.
// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
// catch the problems when the expected method call is totally skipped during test run.
func (mmGetMailingList *mRequestServiceMockGetMailingList) Optional() *mRequestServiceMockGetMailingList {
mmGetMailingList.optional = true
return mmGetMailingList
}
// Expect sets up expected params for RequestService.GetMailingList
func (mmGetMailingList *mRequestServiceMockGetMailingList) Expect(ctx context.Context, userID int) *mRequestServiceMockGetMailingList {
if mmGetMailingList.mock.funcGetMailingList != nil {
mmGetMailingList.mock.t.Fatalf("RequestServiceMock.GetMailingList mock is already set by Set")
}
if mmGetMailingList.defaultExpectation == nil {
mmGetMailingList.defaultExpectation = &RequestServiceMockGetMailingListExpectation{}
}
if mmGetMailingList.defaultExpectation.paramPtrs != nil {
mmGetMailingList.mock.t.Fatalf("RequestServiceMock.GetMailingList mock is already set by ExpectParams functions")
}
mmGetMailingList.defaultExpectation.params = &RequestServiceMockGetMailingListParams{ctx, userID}
mmGetMailingList.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmGetMailingList.expectations {
if minimock.Equal(e.params, mmGetMailingList.defaultExpectation.params) {
mmGetMailingList.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetMailingList.defaultExpectation.params)
}
}
return mmGetMailingList
}
// ExpectCtxParam1 sets up expected param ctx for RequestService.GetMailingList
func (mmGetMailingList *mRequestServiceMockGetMailingList) ExpectCtxParam1(ctx context.Context) *mRequestServiceMockGetMailingList {
if mmGetMailingList.mock.funcGetMailingList != nil {
mmGetMailingList.mock.t.Fatalf("RequestServiceMock.GetMailingList mock is already set by Set")
}
if mmGetMailingList.defaultExpectation == nil {
mmGetMailingList.defaultExpectation = &RequestServiceMockGetMailingListExpectation{}
}
if mmGetMailingList.defaultExpectation.params != nil {
mmGetMailingList.mock.t.Fatalf("RequestServiceMock.GetMailingList mock is already set by Expect")
}
if mmGetMailingList.defaultExpectation.paramPtrs == nil {
mmGetMailingList.defaultExpectation.paramPtrs = &RequestServiceMockGetMailingListParamPtrs{}
}
mmGetMailingList.defaultExpectation.paramPtrs.ctx = &ctx
mmGetMailingList.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmGetMailingList
}
// ExpectUserIDParam2 sets up expected param userID for RequestService.GetMailingList
func (mmGetMailingList *mRequestServiceMockGetMailingList) ExpectUserIDParam2(userID int) *mRequestServiceMockGetMailingList {
if mmGetMailingList.mock.funcGetMailingList != nil {
mmGetMailingList.mock.t.Fatalf("RequestServiceMock.GetMailingList mock is already set by Set")
}
if mmGetMailingList.defaultExpectation == nil {
mmGetMailingList.defaultExpectation = &RequestServiceMockGetMailingListExpectation{}
}
if mmGetMailingList.defaultExpectation.params != nil {
mmGetMailingList.mock.t.Fatalf("RequestServiceMock.GetMailingList mock is already set by Expect")
}
if mmGetMailingList.defaultExpectation.paramPtrs == nil {
mmGetMailingList.defaultExpectation.paramPtrs = &RequestServiceMockGetMailingListParamPtrs{}
}
mmGetMailingList.defaultExpectation.paramPtrs.userID = &userID
mmGetMailingList.defaultExpectation.expectationOrigins.originUserID = minimock.CallerInfo(1)
return mmGetMailingList
}
// Inspect accepts an inspector function that has same arguments as the RequestService.GetMailingList
func (mmGetMailingList *mRequestServiceMockGetMailingList) Inspect(f func(ctx context.Context, userID int)) *mRequestServiceMockGetMailingList {
if mmGetMailingList.mock.inspectFuncGetMailingList != nil {
mmGetMailingList.mock.t.Fatalf("Inspect function is already set for RequestServiceMock.GetMailingList")
}
mmGetMailingList.mock.inspectFuncGetMailingList = f
return mmGetMailingList
}
// Return sets up results that will be returned by RequestService.GetMailingList
func (mmGetMailingList *mRequestServiceMockGetMailingList) Return(rpa1 []*model.Request, err error) *RequestServiceMock {
if mmGetMailingList.mock.funcGetMailingList != nil {
mmGetMailingList.mock.t.Fatalf("RequestServiceMock.GetMailingList mock is already set by Set")
}
if mmGetMailingList.defaultExpectation == nil {
mmGetMailingList.defaultExpectation = &RequestServiceMockGetMailingListExpectation{mock: mmGetMailingList.mock}
}
mmGetMailingList.defaultExpectation.results = &RequestServiceMockGetMailingListResults{rpa1, err}
mmGetMailingList.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmGetMailingList.mock
}
// Set uses given function f to mock the RequestService.GetMailingList method
func (mmGetMailingList *mRequestServiceMockGetMailingList) Set(f func(ctx context.Context, userID int) (rpa1 []*model.Request, err error)) *RequestServiceMock {
if mmGetMailingList.defaultExpectation != nil {
mmGetMailingList.mock.t.Fatalf("Default expectation is already set for the RequestService.GetMailingList method")
}
if len(mmGetMailingList.expectations) > 0 {
mmGetMailingList.mock.t.Fatalf("Some expectations are already set for the RequestService.GetMailingList method")
}
mmGetMailingList.mock.funcGetMailingList = f
mmGetMailingList.mock.funcGetMailingListOrigin = minimock.CallerInfo(1)
return mmGetMailingList.mock
}
// When sets expectation for the RequestService.GetMailingList which will trigger the result defined by the following
// Then helper
func (mmGetMailingList *mRequestServiceMockGetMailingList) When(ctx context.Context, userID int) *RequestServiceMockGetMailingListExpectation {
if mmGetMailingList.mock.funcGetMailingList != nil {
mmGetMailingList.mock.t.Fatalf("RequestServiceMock.GetMailingList mock is already set by Set")
}
expectation := &RequestServiceMockGetMailingListExpectation{
mock: mmGetMailingList.mock,
params: &RequestServiceMockGetMailingListParams{ctx, userID},
expectationOrigins: RequestServiceMockGetMailingListExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmGetMailingList.expectations = append(mmGetMailingList.expectations, expectation)
return expectation
}
// Then sets up RequestService.GetMailingList return parameters for the expectation previously defined by the When method
func (e *RequestServiceMockGetMailingListExpectation) Then(rpa1 []*model.Request, err error) *RequestServiceMock {
e.results = &RequestServiceMockGetMailingListResults{rpa1, err}
return e.mock
}
// Times sets number of times RequestService.GetMailingList should be invoked
func (mmGetMailingList *mRequestServiceMockGetMailingList) Times(n uint64) *mRequestServiceMockGetMailingList {
if n == 0 {
mmGetMailingList.mock.t.Fatalf("Times of RequestServiceMock.GetMailingList mock can not be zero")
}
mm_atomic.StoreUint64(&mmGetMailingList.expectedInvocations, n)
mmGetMailingList.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmGetMailingList
}
func (mmGetMailingList *mRequestServiceMockGetMailingList) invocationsDone() bool {
if len(mmGetMailingList.expectations) == 0 && mmGetMailingList.defaultExpectation == nil && mmGetMailingList.mock.funcGetMailingList == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmGetMailingList.mock.afterGetMailingListCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmGetMailingList.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// GetMailingList implements mm_service.RequestService
func (mmGetMailingList *RequestServiceMock) GetMailingList(ctx context.Context, userID int) (rpa1 []*model.Request, err error) {
mm_atomic.AddUint64(&mmGetMailingList.beforeGetMailingListCounter, 1)
defer mm_atomic.AddUint64(&mmGetMailingList.afterGetMailingListCounter, 1)
mmGetMailingList.t.Helper()
if mmGetMailingList.inspectFuncGetMailingList != nil {
mmGetMailingList.inspectFuncGetMailingList(ctx, userID)
}
mm_params := RequestServiceMockGetMailingListParams{ctx, userID}
// Record call args
mmGetMailingList.GetMailingListMock.mutex.Lock()
mmGetMailingList.GetMailingListMock.callArgs = append(mmGetMailingList.GetMailingListMock.callArgs, &mm_params)
mmGetMailingList.GetMailingListMock.mutex.Unlock()
for _, e := range mmGetMailingList.GetMailingListMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.rpa1, e.results.err
}
}
if mmGetMailingList.GetMailingListMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmGetMailingList.GetMailingListMock.defaultExpectation.Counter, 1)
mm_want := mmGetMailingList.GetMailingListMock.defaultExpectation.params
mm_want_ptrs := mmGetMailingList.GetMailingListMock.defaultExpectation.paramPtrs
mm_got := RequestServiceMockGetMailingListParams{ctx, userID}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmGetMailingList.t.Errorf("RequestServiceMock.GetMailingList got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetMailingList.GetMailingListMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.userID != nil && !minimock.Equal(*mm_want_ptrs.userID, mm_got.userID) {
mmGetMailingList.t.Errorf("RequestServiceMock.GetMailingList got unexpected parameter userID, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetMailingList.GetMailingListMock.defaultExpectation.expectationOrigins.originUserID, *mm_want_ptrs.userID, mm_got.userID, minimock.Diff(*mm_want_ptrs.userID, mm_got.userID))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmGetMailingList.t.Errorf("RequestServiceMock.GetMailingList got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetMailingList.GetMailingListMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmGetMailingList.GetMailingListMock.defaultExpectation.results
if mm_results == nil {
mmGetMailingList.t.Fatal("No results are set for the RequestServiceMock.GetMailingList")
}
return (*mm_results).rpa1, (*mm_results).err
}
if mmGetMailingList.funcGetMailingList != nil {
return mmGetMailingList.funcGetMailingList(ctx, userID)
}
mmGetMailingList.t.Fatalf("Unexpected call to RequestServiceMock.GetMailingList. %v %v", ctx, userID)
return
}
// GetMailingListAfterCounter returns a count of finished RequestServiceMock.GetMailingList invocations
func (mmGetMailingList *RequestServiceMock) GetMailingListAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetMailingList.afterGetMailingListCounter)
}
// GetMailingListBeforeCounter returns a count of RequestServiceMock.GetMailingList invocations
func (mmGetMailingList *RequestServiceMock) GetMailingListBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetMailingList.beforeGetMailingListCounter)
}
// Calls returns a list of arguments used in each call to RequestServiceMock.GetMailingList.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmGetMailingList *mRequestServiceMockGetMailingList) Calls() []*RequestServiceMockGetMailingListParams {
mmGetMailingList.mutex.RLock()
argCopy := make([]*RequestServiceMockGetMailingListParams, len(mmGetMailingList.callArgs))
copy(argCopy, mmGetMailingList.callArgs)
mmGetMailingList.mutex.RUnlock()
return argCopy
}
// MinimockGetMailingListDone returns true if the count of the GetMailingList invocations corresponds
// the number of defined expectations
func (m *RequestServiceMock) MinimockGetMailingListDone() bool {
if m.GetMailingListMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.GetMailingListMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.GetMailingListMock.invocationsDone()
}
// MinimockGetMailingListInspect logs each unmet expectation
func (m *RequestServiceMock) MinimockGetMailingListInspect() {
for _, e := range m.GetMailingListMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestServiceMock.GetMailingList at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterGetMailingListCounter := mm_atomic.LoadUint64(&m.afterGetMailingListCounter)
// if default expectation was set then invocations count should be greater than zero
if m.GetMailingListMock.defaultExpectation != nil && afterGetMailingListCounter < 1 {
if m.GetMailingListMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestServiceMock.GetMailingList at\n%s", m.GetMailingListMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestServiceMock.GetMailingList at\n%s with params: %#v", m.GetMailingListMock.defaultExpectation.expectationOrigins.origin, *m.GetMailingListMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcGetMailingList != nil && afterGetMailingListCounter < 1 {
m.t.Errorf("Expected call to RequestServiceMock.GetMailingList at\n%s", m.funcGetMailingListOrigin)
}
if !m.GetMailingListMock.invocationsDone() && afterGetMailingListCounter > 0 {
m.t.Errorf("Expected %d calls to RequestServiceMock.GetMailingList at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.GetMailingListMock.expectedInvocations), m.GetMailingListMock.expectedInvocationsOrigin, afterGetMailingListCounter)
}
}
type mRequestServiceMockGetMailingListByID struct {
optional bool
mock *RequestServiceMock
defaultExpectation *RequestServiceMockGetMailingListByIDExpectation
expectations []*RequestServiceMockGetMailingListByIDExpectation
callArgs []*RequestServiceMockGetMailingListByIDParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestServiceMockGetMailingListByIDExpectation specifies expectation struct of the RequestService.GetMailingListByID
type RequestServiceMockGetMailingListByIDExpectation struct {
mock *RequestServiceMock
params *RequestServiceMockGetMailingListByIDParams
paramPtrs *RequestServiceMockGetMailingListByIDParamPtrs
expectationOrigins RequestServiceMockGetMailingListByIDExpectationOrigins
results *RequestServiceMockGetMailingListByIDResults
returnOrigin string
Counter uint64
}
// RequestServiceMockGetMailingListByIDParams contains parameters of the RequestService.GetMailingListByID
type RequestServiceMockGetMailingListByIDParams struct {
ctx context.Context
requestID uuid.UUID
userID int
}
// RequestServiceMockGetMailingListByIDParamPtrs contains pointers to parameters of the RequestService.GetMailingListByID
type RequestServiceMockGetMailingListByIDParamPtrs struct {
ctx *context.Context
requestID *uuid.UUID
userID *int
}
// RequestServiceMockGetMailingListByIDResults contains results of the RequestService.GetMailingListByID
type RequestServiceMockGetMailingListByIDResults struct {
rp1 *model.RequestDetail
err error
}
// RequestServiceMockGetMailingListByIDOrigins contains origins of expectations of the RequestService.GetMailingListByID
type RequestServiceMockGetMailingListByIDExpectationOrigins struct {
origin string
originCtx string
originRequestID string
originUserID string
}
// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
// Optional() makes method check to work in '0 or more' mode.
// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
// catch the problems when the expected method call is totally skipped during test run.
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) Optional() *mRequestServiceMockGetMailingListByID {
mmGetMailingListByID.optional = true
return mmGetMailingListByID
}
// Expect sets up expected params for RequestService.GetMailingListByID
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) Expect(ctx context.Context, requestID uuid.UUID, userID int) *mRequestServiceMockGetMailingListByID {
if mmGetMailingListByID.mock.funcGetMailingListByID != nil {
mmGetMailingListByID.mock.t.Fatalf("RequestServiceMock.GetMailingListByID mock is already set by Set")
}
if mmGetMailingListByID.defaultExpectation == nil {
mmGetMailingListByID.defaultExpectation = &RequestServiceMockGetMailingListByIDExpectation{}
}
if mmGetMailingListByID.defaultExpectation.paramPtrs != nil {
mmGetMailingListByID.mock.t.Fatalf("RequestServiceMock.GetMailingListByID mock is already set by ExpectParams functions")
}
mmGetMailingListByID.defaultExpectation.params = &RequestServiceMockGetMailingListByIDParams{ctx, requestID, userID}
mmGetMailingListByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmGetMailingListByID.expectations {
if minimock.Equal(e.params, mmGetMailingListByID.defaultExpectation.params) {
mmGetMailingListByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetMailingListByID.defaultExpectation.params)
}
}
return mmGetMailingListByID
}
// ExpectCtxParam1 sets up expected param ctx for RequestService.GetMailingListByID
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) ExpectCtxParam1(ctx context.Context) *mRequestServiceMockGetMailingListByID {
if mmGetMailingListByID.mock.funcGetMailingListByID != nil {
mmGetMailingListByID.mock.t.Fatalf("RequestServiceMock.GetMailingListByID mock is already set by Set")
}
if mmGetMailingListByID.defaultExpectation == nil {
mmGetMailingListByID.defaultExpectation = &RequestServiceMockGetMailingListByIDExpectation{}
}
if mmGetMailingListByID.defaultExpectation.params != nil {
mmGetMailingListByID.mock.t.Fatalf("RequestServiceMock.GetMailingListByID mock is already set by Expect")
}
if mmGetMailingListByID.defaultExpectation.paramPtrs == nil {
mmGetMailingListByID.defaultExpectation.paramPtrs = &RequestServiceMockGetMailingListByIDParamPtrs{}
}
mmGetMailingListByID.defaultExpectation.paramPtrs.ctx = &ctx
mmGetMailingListByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmGetMailingListByID
}
// ExpectRequestIDParam2 sets up expected param requestID for RequestService.GetMailingListByID
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) ExpectRequestIDParam2(requestID uuid.UUID) *mRequestServiceMockGetMailingListByID {
if mmGetMailingListByID.mock.funcGetMailingListByID != nil {
mmGetMailingListByID.mock.t.Fatalf("RequestServiceMock.GetMailingListByID mock is already set by Set")
}
if mmGetMailingListByID.defaultExpectation == nil {
mmGetMailingListByID.defaultExpectation = &RequestServiceMockGetMailingListByIDExpectation{}
}
if mmGetMailingListByID.defaultExpectation.params != nil {
mmGetMailingListByID.mock.t.Fatalf("RequestServiceMock.GetMailingListByID mock is already set by Expect")
}
if mmGetMailingListByID.defaultExpectation.paramPtrs == nil {
mmGetMailingListByID.defaultExpectation.paramPtrs = &RequestServiceMockGetMailingListByIDParamPtrs{}
}
mmGetMailingListByID.defaultExpectation.paramPtrs.requestID = &requestID
mmGetMailingListByID.defaultExpectation.expectationOrigins.originRequestID = minimock.CallerInfo(1)
return mmGetMailingListByID
}
// ExpectUserIDParam3 sets up expected param userID for RequestService.GetMailingListByID
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) ExpectUserIDParam3(userID int) *mRequestServiceMockGetMailingListByID {
if mmGetMailingListByID.mock.funcGetMailingListByID != nil {
mmGetMailingListByID.mock.t.Fatalf("RequestServiceMock.GetMailingListByID mock is already set by Set")
}
if mmGetMailingListByID.defaultExpectation == nil {
mmGetMailingListByID.defaultExpectation = &RequestServiceMockGetMailingListByIDExpectation{}
}
if mmGetMailingListByID.defaultExpectation.params != nil {
mmGetMailingListByID.mock.t.Fatalf("RequestServiceMock.GetMailingListByID mock is already set by Expect")
}
if mmGetMailingListByID.defaultExpectation.paramPtrs == nil {
mmGetMailingListByID.defaultExpectation.paramPtrs = &RequestServiceMockGetMailingListByIDParamPtrs{}
}
mmGetMailingListByID.defaultExpectation.paramPtrs.userID = &userID
mmGetMailingListByID.defaultExpectation.expectationOrigins.originUserID = minimock.CallerInfo(1)
return mmGetMailingListByID
}
// Inspect accepts an inspector function that has same arguments as the RequestService.GetMailingListByID
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) Inspect(f func(ctx context.Context, requestID uuid.UUID, userID int)) *mRequestServiceMockGetMailingListByID {
if mmGetMailingListByID.mock.inspectFuncGetMailingListByID != nil {
mmGetMailingListByID.mock.t.Fatalf("Inspect function is already set for RequestServiceMock.GetMailingListByID")
}
mmGetMailingListByID.mock.inspectFuncGetMailingListByID = f
return mmGetMailingListByID
}
// Return sets up results that will be returned by RequestService.GetMailingListByID
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) Return(rp1 *model.RequestDetail, err error) *RequestServiceMock {
if mmGetMailingListByID.mock.funcGetMailingListByID != nil {
mmGetMailingListByID.mock.t.Fatalf("RequestServiceMock.GetMailingListByID mock is already set by Set")
}
if mmGetMailingListByID.defaultExpectation == nil {
mmGetMailingListByID.defaultExpectation = &RequestServiceMockGetMailingListByIDExpectation{mock: mmGetMailingListByID.mock}
}
mmGetMailingListByID.defaultExpectation.results = &RequestServiceMockGetMailingListByIDResults{rp1, err}
mmGetMailingListByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmGetMailingListByID.mock
}
// Set uses given function f to mock the RequestService.GetMailingListByID method
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) Set(f func(ctx context.Context, requestID uuid.UUID, userID int) (rp1 *model.RequestDetail, err error)) *RequestServiceMock {
if mmGetMailingListByID.defaultExpectation != nil {
mmGetMailingListByID.mock.t.Fatalf("Default expectation is already set for the RequestService.GetMailingListByID method")
}
if len(mmGetMailingListByID.expectations) > 0 {
mmGetMailingListByID.mock.t.Fatalf("Some expectations are already set for the RequestService.GetMailingListByID method")
}
mmGetMailingListByID.mock.funcGetMailingListByID = f
mmGetMailingListByID.mock.funcGetMailingListByIDOrigin = minimock.CallerInfo(1)
return mmGetMailingListByID.mock
}
// When sets expectation for the RequestService.GetMailingListByID which will trigger the result defined by the following
// Then helper
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) When(ctx context.Context, requestID uuid.UUID, userID int) *RequestServiceMockGetMailingListByIDExpectation {
if mmGetMailingListByID.mock.funcGetMailingListByID != nil {
mmGetMailingListByID.mock.t.Fatalf("RequestServiceMock.GetMailingListByID mock is already set by Set")
}
expectation := &RequestServiceMockGetMailingListByIDExpectation{
mock: mmGetMailingListByID.mock,
params: &RequestServiceMockGetMailingListByIDParams{ctx, requestID, userID},
expectationOrigins: RequestServiceMockGetMailingListByIDExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmGetMailingListByID.expectations = append(mmGetMailingListByID.expectations, expectation)
return expectation
}
// Then sets up RequestService.GetMailingListByID return parameters for the expectation previously defined by the When method
func (e *RequestServiceMockGetMailingListByIDExpectation) Then(rp1 *model.RequestDetail, err error) *RequestServiceMock {
e.results = &RequestServiceMockGetMailingListByIDResults{rp1, err}
return e.mock
}
// Times sets number of times RequestService.GetMailingListByID should be invoked
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) Times(n uint64) *mRequestServiceMockGetMailingListByID {
if n == 0 {
mmGetMailingListByID.mock.t.Fatalf("Times of RequestServiceMock.GetMailingListByID mock can not be zero")
}
mm_atomic.StoreUint64(&mmGetMailingListByID.expectedInvocations, n)
mmGetMailingListByID.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmGetMailingListByID
}
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) invocationsDone() bool {
if len(mmGetMailingListByID.expectations) == 0 && mmGetMailingListByID.defaultExpectation == nil && mmGetMailingListByID.mock.funcGetMailingListByID == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmGetMailingListByID.mock.afterGetMailingListByIDCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmGetMailingListByID.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// GetMailingListByID implements mm_service.RequestService
func (mmGetMailingListByID *RequestServiceMock) GetMailingListByID(ctx context.Context, requestID uuid.UUID, userID int) (rp1 *model.RequestDetail, err error) {
mm_atomic.AddUint64(&mmGetMailingListByID.beforeGetMailingListByIDCounter, 1)
defer mm_atomic.AddUint64(&mmGetMailingListByID.afterGetMailingListByIDCounter, 1)
mmGetMailingListByID.t.Helper()
if mmGetMailingListByID.inspectFuncGetMailingListByID != nil {
mmGetMailingListByID.inspectFuncGetMailingListByID(ctx, requestID, userID)
}
mm_params := RequestServiceMockGetMailingListByIDParams{ctx, requestID, userID}
// Record call args
mmGetMailingListByID.GetMailingListByIDMock.mutex.Lock()
mmGetMailingListByID.GetMailingListByIDMock.callArgs = append(mmGetMailingListByID.GetMailingListByIDMock.callArgs, &mm_params)
mmGetMailingListByID.GetMailingListByIDMock.mutex.Unlock()
for _, e := range mmGetMailingListByID.GetMailingListByIDMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.rp1, e.results.err
}
}
if mmGetMailingListByID.GetMailingListByIDMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmGetMailingListByID.GetMailingListByIDMock.defaultExpectation.Counter, 1)
mm_want := mmGetMailingListByID.GetMailingListByIDMock.defaultExpectation.params
mm_want_ptrs := mmGetMailingListByID.GetMailingListByIDMock.defaultExpectation.paramPtrs
mm_got := RequestServiceMockGetMailingListByIDParams{ctx, requestID, userID}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmGetMailingListByID.t.Errorf("RequestServiceMock.GetMailingListByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetMailingListByID.GetMailingListByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.requestID != nil && !minimock.Equal(*mm_want_ptrs.requestID, mm_got.requestID) {
mmGetMailingListByID.t.Errorf("RequestServiceMock.GetMailingListByID got unexpected parameter requestID, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetMailingListByID.GetMailingListByIDMock.defaultExpectation.expectationOrigins.originRequestID, *mm_want_ptrs.requestID, mm_got.requestID, minimock.Diff(*mm_want_ptrs.requestID, mm_got.requestID))
}
if mm_want_ptrs.userID != nil && !minimock.Equal(*mm_want_ptrs.userID, mm_got.userID) {
mmGetMailingListByID.t.Errorf("RequestServiceMock.GetMailingListByID got unexpected parameter userID, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetMailingListByID.GetMailingListByIDMock.defaultExpectation.expectationOrigins.originUserID, *mm_want_ptrs.userID, mm_got.userID, minimock.Diff(*mm_want_ptrs.userID, mm_got.userID))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmGetMailingListByID.t.Errorf("RequestServiceMock.GetMailingListByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetMailingListByID.GetMailingListByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmGetMailingListByID.GetMailingListByIDMock.defaultExpectation.results
if mm_results == nil {
mmGetMailingListByID.t.Fatal("No results are set for the RequestServiceMock.GetMailingListByID")
}
return (*mm_results).rp1, (*mm_results).err
}
if mmGetMailingListByID.funcGetMailingListByID != nil {
return mmGetMailingListByID.funcGetMailingListByID(ctx, requestID, userID)
}
mmGetMailingListByID.t.Fatalf("Unexpected call to RequestServiceMock.GetMailingListByID. %v %v %v", ctx, requestID, userID)
return
}
// GetMailingListByIDAfterCounter returns a count of finished RequestServiceMock.GetMailingListByID invocations
func (mmGetMailingListByID *RequestServiceMock) GetMailingListByIDAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetMailingListByID.afterGetMailingListByIDCounter)
}
// GetMailingListByIDBeforeCounter returns a count of RequestServiceMock.GetMailingListByID invocations
func (mmGetMailingListByID *RequestServiceMock) GetMailingListByIDBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetMailingListByID.beforeGetMailingListByIDCounter)
}
// Calls returns a list of arguments used in each call to RequestServiceMock.GetMailingListByID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmGetMailingListByID *mRequestServiceMockGetMailingListByID) Calls() []*RequestServiceMockGetMailingListByIDParams {
mmGetMailingListByID.mutex.RLock()
argCopy := make([]*RequestServiceMockGetMailingListByIDParams, len(mmGetMailingListByID.callArgs))
copy(argCopy, mmGetMailingListByID.callArgs)
mmGetMailingListByID.mutex.RUnlock()
return argCopy
}
// MinimockGetMailingListByIDDone returns true if the count of the GetMailingListByID invocations corresponds
// the number of defined expectations
func (m *RequestServiceMock) MinimockGetMailingListByIDDone() bool {
if m.GetMailingListByIDMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.GetMailingListByIDMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.GetMailingListByIDMock.invocationsDone()
}
// MinimockGetMailingListByIDInspect logs each unmet expectation
func (m *RequestServiceMock) MinimockGetMailingListByIDInspect() {
for _, e := range m.GetMailingListByIDMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestServiceMock.GetMailingListByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterGetMailingListByIDCounter := mm_atomic.LoadUint64(&m.afterGetMailingListByIDCounter)
// if default expectation was set then invocations count should be greater than zero
if m.GetMailingListByIDMock.defaultExpectation != nil && afterGetMailingListByIDCounter < 1 {
if m.GetMailingListByIDMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestServiceMock.GetMailingListByID at\n%s", m.GetMailingListByIDMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestServiceMock.GetMailingListByID at\n%s with params: %#v", m.GetMailingListByIDMock.defaultExpectation.expectationOrigins.origin, *m.GetMailingListByIDMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcGetMailingListByID != nil && afterGetMailingListByIDCounter < 1 {
m.t.Errorf("Expected call to RequestServiceMock.GetMailingListByID at\n%s", m.funcGetMailingListByIDOrigin)
}
if !m.GetMailingListByIDMock.invocationsDone() && afterGetMailingListByIDCounter > 0 {
m.t.Errorf("Expected %d calls to RequestServiceMock.GetMailingListByID at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.GetMailingListByIDMock.expectedInvocations), m.GetMailingListByIDMock.expectedInvocationsOrigin, afterGetMailingListByIDCounter)
}
}
// MinimockFinish checks that all mocked methods have been called the expected number of times
func (m *RequestServiceMock) MinimockFinish() {
m.finishOnce.Do(func() {
if !m.minimockDone() {
m.MinimockApproveTZInspect()
m.MinimockCreateTZInspect()
m.MinimockGetMailingListInspect()
m.MinimockGetMailingListByIDInspect()
}
})
}
// MinimockWait waits for all mocked methods to be called the expected number of times
func (m *RequestServiceMock) MinimockWait(timeout mm_time.Duration) {
timeoutCh := mm_time.After(timeout)
for {
if m.minimockDone() {
return
}
select {
case <-timeoutCh:
m.MinimockFinish()
return
case <-mm_time.After(10 * mm_time.Millisecond):
}
}
}
func (m *RequestServiceMock) minimockDone() bool {
done := true
return done &&
m.MinimockApproveTZDone() &&
m.MinimockCreateTZDone() &&
m.MinimockGetMailingListDone() &&
m.MinimockGetMailingListByIDDone()
}