Files
smart-search-back/internal/mocks/request_repository_mock.go
vallyenfail d782ab21ab
All checks were successful
Deploy Smart Search Backend Test / deploy (push) Successful in 1m36s
add service
2026-01-19 16:26:03 +03:00

3484 lines
154 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/repository.RequestRepository -o request_repository_mock.go -n RequestRepositoryMock -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"
"github.com/jackc/pgx/v5"
)
// RequestRepositoryMock implements mm_repository.RequestRepository
type RequestRepositoryMock struct {
t minimock.Tester
finishOnce sync.Once
funcCheckOwnership func(ctx context.Context, requestID uuid.UUID, userID int) (b1 bool, err error)
funcCheckOwnershipOrigin string
inspectFuncCheckOwnership func(ctx context.Context, requestID uuid.UUID, userID int)
afterCheckOwnershipCounter uint64
beforeCheckOwnershipCounter uint64
CheckOwnershipMock mRequestRepositoryMockCheckOwnership
funcCreate func(ctx context.Context, req *model.Request) (err error)
funcCreateOrigin string
inspectFuncCreate func(ctx context.Context, req *model.Request)
afterCreateCounter uint64
beforeCreateCounter uint64
CreateMock mRequestRepositoryMockCreate
funcGetByID func(ctx context.Context, id uuid.UUID) (rp1 *model.Request, err error)
funcGetByIDOrigin string
inspectFuncGetByID func(ctx context.Context, id uuid.UUID)
afterGetByIDCounter uint64
beforeGetByIDCounter uint64
GetByIDMock mRequestRepositoryMockGetByID
funcGetByUserID func(ctx context.Context, userID int) (rpa1 []*model.Request, err error)
funcGetByUserIDOrigin string
inspectFuncGetByUserID func(ctx context.Context, userID int)
afterGetByUserIDCounter uint64
beforeGetByUserIDCounter uint64
GetByUserIDMock mRequestRepositoryMockGetByUserID
funcGetDetailByID func(ctx context.Context, id uuid.UUID) (rp1 *model.RequestDetail, err error)
funcGetDetailByIDOrigin string
inspectFuncGetDetailByID func(ctx context.Context, id uuid.UUID)
afterGetDetailByIDCounter uint64
beforeGetDetailByIDCounter uint64
GetDetailByIDMock mRequestRepositoryMockGetDetailByID
funcGetUserStatistics func(ctx context.Context, userID int) (requestsCount int, suppliersCount int, createdTZ int, err error)
funcGetUserStatisticsOrigin string
inspectFuncGetUserStatistics func(ctx context.Context, userID int)
afterGetUserStatisticsCounter uint64
beforeGetUserStatisticsCounter uint64
GetUserStatisticsMock mRequestRepositoryMockGetUserStatistics
funcUpdateFinalTZ func(ctx context.Context, id uuid.UUID, finalTZ string) (err error)
funcUpdateFinalTZOrigin string
inspectFuncUpdateFinalTZ func(ctx context.Context, id uuid.UUID, finalTZ string)
afterUpdateFinalTZCounter uint64
beforeUpdateFinalTZCounter uint64
UpdateFinalTZMock mRequestRepositoryMockUpdateFinalTZ
funcUpdateWithTZ func(ctx context.Context, id uuid.UUID, tz string, generated bool) (err error)
funcUpdateWithTZOrigin string
inspectFuncUpdateWithTZ func(ctx context.Context, id uuid.UUID, tz string, generated bool)
afterUpdateWithTZCounter uint64
beforeUpdateWithTZCounter uint64
UpdateWithTZMock mRequestRepositoryMockUpdateWithTZ
funcUpdateWithTZTx func(ctx context.Context, tx pgx.Tx, id uuid.UUID, tz string, generated bool) (err error)
funcUpdateWithTZTxOrigin string
inspectFuncUpdateWithTZTx func(ctx context.Context, tx pgx.Tx, id uuid.UUID, tz string, generated bool)
afterUpdateWithTZTxCounter uint64
beforeUpdateWithTZTxCounter uint64
UpdateWithTZTxMock mRequestRepositoryMockUpdateWithTZTx
}
// NewRequestRepositoryMock returns a mock for mm_repository.RequestRepository
func NewRequestRepositoryMock(t minimock.Tester) *RequestRepositoryMock {
m := &RequestRepositoryMock{t: t}
if controller, ok := t.(minimock.MockController); ok {
controller.RegisterMocker(m)
}
m.CheckOwnershipMock = mRequestRepositoryMockCheckOwnership{mock: m}
m.CheckOwnershipMock.callArgs = []*RequestRepositoryMockCheckOwnershipParams{}
m.CreateMock = mRequestRepositoryMockCreate{mock: m}
m.CreateMock.callArgs = []*RequestRepositoryMockCreateParams{}
m.GetByIDMock = mRequestRepositoryMockGetByID{mock: m}
m.GetByIDMock.callArgs = []*RequestRepositoryMockGetByIDParams{}
m.GetByUserIDMock = mRequestRepositoryMockGetByUserID{mock: m}
m.GetByUserIDMock.callArgs = []*RequestRepositoryMockGetByUserIDParams{}
m.GetDetailByIDMock = mRequestRepositoryMockGetDetailByID{mock: m}
m.GetDetailByIDMock.callArgs = []*RequestRepositoryMockGetDetailByIDParams{}
m.GetUserStatisticsMock = mRequestRepositoryMockGetUserStatistics{mock: m}
m.GetUserStatisticsMock.callArgs = []*RequestRepositoryMockGetUserStatisticsParams{}
m.UpdateFinalTZMock = mRequestRepositoryMockUpdateFinalTZ{mock: m}
m.UpdateFinalTZMock.callArgs = []*RequestRepositoryMockUpdateFinalTZParams{}
m.UpdateWithTZMock = mRequestRepositoryMockUpdateWithTZ{mock: m}
m.UpdateWithTZMock.callArgs = []*RequestRepositoryMockUpdateWithTZParams{}
m.UpdateWithTZTxMock = mRequestRepositoryMockUpdateWithTZTx{mock: m}
m.UpdateWithTZTxMock.callArgs = []*RequestRepositoryMockUpdateWithTZTxParams{}
t.Cleanup(m.MinimockFinish)
return m
}
type mRequestRepositoryMockCheckOwnership struct {
optional bool
mock *RequestRepositoryMock
defaultExpectation *RequestRepositoryMockCheckOwnershipExpectation
expectations []*RequestRepositoryMockCheckOwnershipExpectation
callArgs []*RequestRepositoryMockCheckOwnershipParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestRepositoryMockCheckOwnershipExpectation specifies expectation struct of the RequestRepository.CheckOwnership
type RequestRepositoryMockCheckOwnershipExpectation struct {
mock *RequestRepositoryMock
params *RequestRepositoryMockCheckOwnershipParams
paramPtrs *RequestRepositoryMockCheckOwnershipParamPtrs
expectationOrigins RequestRepositoryMockCheckOwnershipExpectationOrigins
results *RequestRepositoryMockCheckOwnershipResults
returnOrigin string
Counter uint64
}
// RequestRepositoryMockCheckOwnershipParams contains parameters of the RequestRepository.CheckOwnership
type RequestRepositoryMockCheckOwnershipParams struct {
ctx context.Context
requestID uuid.UUID
userID int
}
// RequestRepositoryMockCheckOwnershipParamPtrs contains pointers to parameters of the RequestRepository.CheckOwnership
type RequestRepositoryMockCheckOwnershipParamPtrs struct {
ctx *context.Context
requestID *uuid.UUID
userID *int
}
// RequestRepositoryMockCheckOwnershipResults contains results of the RequestRepository.CheckOwnership
type RequestRepositoryMockCheckOwnershipResults struct {
b1 bool
err error
}
// RequestRepositoryMockCheckOwnershipOrigins contains origins of expectations of the RequestRepository.CheckOwnership
type RequestRepositoryMockCheckOwnershipExpectationOrigins 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 (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) Optional() *mRequestRepositoryMockCheckOwnership {
mmCheckOwnership.optional = true
return mmCheckOwnership
}
// Expect sets up expected params for RequestRepository.CheckOwnership
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) Expect(ctx context.Context, requestID uuid.UUID, userID int) *mRequestRepositoryMockCheckOwnership {
if mmCheckOwnership.mock.funcCheckOwnership != nil {
mmCheckOwnership.mock.t.Fatalf("RequestRepositoryMock.CheckOwnership mock is already set by Set")
}
if mmCheckOwnership.defaultExpectation == nil {
mmCheckOwnership.defaultExpectation = &RequestRepositoryMockCheckOwnershipExpectation{}
}
if mmCheckOwnership.defaultExpectation.paramPtrs != nil {
mmCheckOwnership.mock.t.Fatalf("RequestRepositoryMock.CheckOwnership mock is already set by ExpectParams functions")
}
mmCheckOwnership.defaultExpectation.params = &RequestRepositoryMockCheckOwnershipParams{ctx, requestID, userID}
mmCheckOwnership.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmCheckOwnership.expectations {
if minimock.Equal(e.params, mmCheckOwnership.defaultExpectation.params) {
mmCheckOwnership.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCheckOwnership.defaultExpectation.params)
}
}
return mmCheckOwnership
}
// ExpectCtxParam1 sets up expected param ctx for RequestRepository.CheckOwnership
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) ExpectCtxParam1(ctx context.Context) *mRequestRepositoryMockCheckOwnership {
if mmCheckOwnership.mock.funcCheckOwnership != nil {
mmCheckOwnership.mock.t.Fatalf("RequestRepositoryMock.CheckOwnership mock is already set by Set")
}
if mmCheckOwnership.defaultExpectation == nil {
mmCheckOwnership.defaultExpectation = &RequestRepositoryMockCheckOwnershipExpectation{}
}
if mmCheckOwnership.defaultExpectation.params != nil {
mmCheckOwnership.mock.t.Fatalf("RequestRepositoryMock.CheckOwnership mock is already set by Expect")
}
if mmCheckOwnership.defaultExpectation.paramPtrs == nil {
mmCheckOwnership.defaultExpectation.paramPtrs = &RequestRepositoryMockCheckOwnershipParamPtrs{}
}
mmCheckOwnership.defaultExpectation.paramPtrs.ctx = &ctx
mmCheckOwnership.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmCheckOwnership
}
// ExpectRequestIDParam2 sets up expected param requestID for RequestRepository.CheckOwnership
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) ExpectRequestIDParam2(requestID uuid.UUID) *mRequestRepositoryMockCheckOwnership {
if mmCheckOwnership.mock.funcCheckOwnership != nil {
mmCheckOwnership.mock.t.Fatalf("RequestRepositoryMock.CheckOwnership mock is already set by Set")
}
if mmCheckOwnership.defaultExpectation == nil {
mmCheckOwnership.defaultExpectation = &RequestRepositoryMockCheckOwnershipExpectation{}
}
if mmCheckOwnership.defaultExpectation.params != nil {
mmCheckOwnership.mock.t.Fatalf("RequestRepositoryMock.CheckOwnership mock is already set by Expect")
}
if mmCheckOwnership.defaultExpectation.paramPtrs == nil {
mmCheckOwnership.defaultExpectation.paramPtrs = &RequestRepositoryMockCheckOwnershipParamPtrs{}
}
mmCheckOwnership.defaultExpectation.paramPtrs.requestID = &requestID
mmCheckOwnership.defaultExpectation.expectationOrigins.originRequestID = minimock.CallerInfo(1)
return mmCheckOwnership
}
// ExpectUserIDParam3 sets up expected param userID for RequestRepository.CheckOwnership
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) ExpectUserIDParam3(userID int) *mRequestRepositoryMockCheckOwnership {
if mmCheckOwnership.mock.funcCheckOwnership != nil {
mmCheckOwnership.mock.t.Fatalf("RequestRepositoryMock.CheckOwnership mock is already set by Set")
}
if mmCheckOwnership.defaultExpectation == nil {
mmCheckOwnership.defaultExpectation = &RequestRepositoryMockCheckOwnershipExpectation{}
}
if mmCheckOwnership.defaultExpectation.params != nil {
mmCheckOwnership.mock.t.Fatalf("RequestRepositoryMock.CheckOwnership mock is already set by Expect")
}
if mmCheckOwnership.defaultExpectation.paramPtrs == nil {
mmCheckOwnership.defaultExpectation.paramPtrs = &RequestRepositoryMockCheckOwnershipParamPtrs{}
}
mmCheckOwnership.defaultExpectation.paramPtrs.userID = &userID
mmCheckOwnership.defaultExpectation.expectationOrigins.originUserID = minimock.CallerInfo(1)
return mmCheckOwnership
}
// Inspect accepts an inspector function that has same arguments as the RequestRepository.CheckOwnership
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) Inspect(f func(ctx context.Context, requestID uuid.UUID, userID int)) *mRequestRepositoryMockCheckOwnership {
if mmCheckOwnership.mock.inspectFuncCheckOwnership != nil {
mmCheckOwnership.mock.t.Fatalf("Inspect function is already set for RequestRepositoryMock.CheckOwnership")
}
mmCheckOwnership.mock.inspectFuncCheckOwnership = f
return mmCheckOwnership
}
// Return sets up results that will be returned by RequestRepository.CheckOwnership
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) Return(b1 bool, err error) *RequestRepositoryMock {
if mmCheckOwnership.mock.funcCheckOwnership != nil {
mmCheckOwnership.mock.t.Fatalf("RequestRepositoryMock.CheckOwnership mock is already set by Set")
}
if mmCheckOwnership.defaultExpectation == nil {
mmCheckOwnership.defaultExpectation = &RequestRepositoryMockCheckOwnershipExpectation{mock: mmCheckOwnership.mock}
}
mmCheckOwnership.defaultExpectation.results = &RequestRepositoryMockCheckOwnershipResults{b1, err}
mmCheckOwnership.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmCheckOwnership.mock
}
// Set uses given function f to mock the RequestRepository.CheckOwnership method
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) Set(f func(ctx context.Context, requestID uuid.UUID, userID int) (b1 bool, err error)) *RequestRepositoryMock {
if mmCheckOwnership.defaultExpectation != nil {
mmCheckOwnership.mock.t.Fatalf("Default expectation is already set for the RequestRepository.CheckOwnership method")
}
if len(mmCheckOwnership.expectations) > 0 {
mmCheckOwnership.mock.t.Fatalf("Some expectations are already set for the RequestRepository.CheckOwnership method")
}
mmCheckOwnership.mock.funcCheckOwnership = f
mmCheckOwnership.mock.funcCheckOwnershipOrigin = minimock.CallerInfo(1)
return mmCheckOwnership.mock
}
// When sets expectation for the RequestRepository.CheckOwnership which will trigger the result defined by the following
// Then helper
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) When(ctx context.Context, requestID uuid.UUID, userID int) *RequestRepositoryMockCheckOwnershipExpectation {
if mmCheckOwnership.mock.funcCheckOwnership != nil {
mmCheckOwnership.mock.t.Fatalf("RequestRepositoryMock.CheckOwnership mock is already set by Set")
}
expectation := &RequestRepositoryMockCheckOwnershipExpectation{
mock: mmCheckOwnership.mock,
params: &RequestRepositoryMockCheckOwnershipParams{ctx, requestID, userID},
expectationOrigins: RequestRepositoryMockCheckOwnershipExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmCheckOwnership.expectations = append(mmCheckOwnership.expectations, expectation)
return expectation
}
// Then sets up RequestRepository.CheckOwnership return parameters for the expectation previously defined by the When method
func (e *RequestRepositoryMockCheckOwnershipExpectation) Then(b1 bool, err error) *RequestRepositoryMock {
e.results = &RequestRepositoryMockCheckOwnershipResults{b1, err}
return e.mock
}
// Times sets number of times RequestRepository.CheckOwnership should be invoked
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) Times(n uint64) *mRequestRepositoryMockCheckOwnership {
if n == 0 {
mmCheckOwnership.mock.t.Fatalf("Times of RequestRepositoryMock.CheckOwnership mock can not be zero")
}
mm_atomic.StoreUint64(&mmCheckOwnership.expectedInvocations, n)
mmCheckOwnership.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmCheckOwnership
}
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) invocationsDone() bool {
if len(mmCheckOwnership.expectations) == 0 && mmCheckOwnership.defaultExpectation == nil && mmCheckOwnership.mock.funcCheckOwnership == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmCheckOwnership.mock.afterCheckOwnershipCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmCheckOwnership.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// CheckOwnership implements mm_repository.RequestRepository
func (mmCheckOwnership *RequestRepositoryMock) CheckOwnership(ctx context.Context, requestID uuid.UUID, userID int) (b1 bool, err error) {
mm_atomic.AddUint64(&mmCheckOwnership.beforeCheckOwnershipCounter, 1)
defer mm_atomic.AddUint64(&mmCheckOwnership.afterCheckOwnershipCounter, 1)
mmCheckOwnership.t.Helper()
if mmCheckOwnership.inspectFuncCheckOwnership != nil {
mmCheckOwnership.inspectFuncCheckOwnership(ctx, requestID, userID)
}
mm_params := RequestRepositoryMockCheckOwnershipParams{ctx, requestID, userID}
// Record call args
mmCheckOwnership.CheckOwnershipMock.mutex.Lock()
mmCheckOwnership.CheckOwnershipMock.callArgs = append(mmCheckOwnership.CheckOwnershipMock.callArgs, &mm_params)
mmCheckOwnership.CheckOwnershipMock.mutex.Unlock()
for _, e := range mmCheckOwnership.CheckOwnershipMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.b1, e.results.err
}
}
if mmCheckOwnership.CheckOwnershipMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmCheckOwnership.CheckOwnershipMock.defaultExpectation.Counter, 1)
mm_want := mmCheckOwnership.CheckOwnershipMock.defaultExpectation.params
mm_want_ptrs := mmCheckOwnership.CheckOwnershipMock.defaultExpectation.paramPtrs
mm_got := RequestRepositoryMockCheckOwnershipParams{ctx, requestID, userID}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmCheckOwnership.t.Errorf("RequestRepositoryMock.CheckOwnership got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCheckOwnership.CheckOwnershipMock.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) {
mmCheckOwnership.t.Errorf("RequestRepositoryMock.CheckOwnership got unexpected parameter requestID, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCheckOwnership.CheckOwnershipMock.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) {
mmCheckOwnership.t.Errorf("RequestRepositoryMock.CheckOwnership got unexpected parameter userID, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCheckOwnership.CheckOwnershipMock.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) {
mmCheckOwnership.t.Errorf("RequestRepositoryMock.CheckOwnership got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCheckOwnership.CheckOwnershipMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmCheckOwnership.CheckOwnershipMock.defaultExpectation.results
if mm_results == nil {
mmCheckOwnership.t.Fatal("No results are set for the RequestRepositoryMock.CheckOwnership")
}
return (*mm_results).b1, (*mm_results).err
}
if mmCheckOwnership.funcCheckOwnership != nil {
return mmCheckOwnership.funcCheckOwnership(ctx, requestID, userID)
}
mmCheckOwnership.t.Fatalf("Unexpected call to RequestRepositoryMock.CheckOwnership. %v %v %v", ctx, requestID, userID)
return
}
// CheckOwnershipAfterCounter returns a count of finished RequestRepositoryMock.CheckOwnership invocations
func (mmCheckOwnership *RequestRepositoryMock) CheckOwnershipAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmCheckOwnership.afterCheckOwnershipCounter)
}
// CheckOwnershipBeforeCounter returns a count of RequestRepositoryMock.CheckOwnership invocations
func (mmCheckOwnership *RequestRepositoryMock) CheckOwnershipBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmCheckOwnership.beforeCheckOwnershipCounter)
}
// Calls returns a list of arguments used in each call to RequestRepositoryMock.CheckOwnership.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmCheckOwnership *mRequestRepositoryMockCheckOwnership) Calls() []*RequestRepositoryMockCheckOwnershipParams {
mmCheckOwnership.mutex.RLock()
argCopy := make([]*RequestRepositoryMockCheckOwnershipParams, len(mmCheckOwnership.callArgs))
copy(argCopy, mmCheckOwnership.callArgs)
mmCheckOwnership.mutex.RUnlock()
return argCopy
}
// MinimockCheckOwnershipDone returns true if the count of the CheckOwnership invocations corresponds
// the number of defined expectations
func (m *RequestRepositoryMock) MinimockCheckOwnershipDone() bool {
if m.CheckOwnershipMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.CheckOwnershipMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.CheckOwnershipMock.invocationsDone()
}
// MinimockCheckOwnershipInspect logs each unmet expectation
func (m *RequestRepositoryMock) MinimockCheckOwnershipInspect() {
for _, e := range m.CheckOwnershipMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.CheckOwnership at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterCheckOwnershipCounter := mm_atomic.LoadUint64(&m.afterCheckOwnershipCounter)
// if default expectation was set then invocations count should be greater than zero
if m.CheckOwnershipMock.defaultExpectation != nil && afterCheckOwnershipCounter < 1 {
if m.CheckOwnershipMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestRepositoryMock.CheckOwnership at\n%s", m.CheckOwnershipMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestRepositoryMock.CheckOwnership at\n%s with params: %#v", m.CheckOwnershipMock.defaultExpectation.expectationOrigins.origin, *m.CheckOwnershipMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcCheckOwnership != nil && afterCheckOwnershipCounter < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.CheckOwnership at\n%s", m.funcCheckOwnershipOrigin)
}
if !m.CheckOwnershipMock.invocationsDone() && afterCheckOwnershipCounter > 0 {
m.t.Errorf("Expected %d calls to RequestRepositoryMock.CheckOwnership at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.CheckOwnershipMock.expectedInvocations), m.CheckOwnershipMock.expectedInvocationsOrigin, afterCheckOwnershipCounter)
}
}
type mRequestRepositoryMockCreate struct {
optional bool
mock *RequestRepositoryMock
defaultExpectation *RequestRepositoryMockCreateExpectation
expectations []*RequestRepositoryMockCreateExpectation
callArgs []*RequestRepositoryMockCreateParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestRepositoryMockCreateExpectation specifies expectation struct of the RequestRepository.Create
type RequestRepositoryMockCreateExpectation struct {
mock *RequestRepositoryMock
params *RequestRepositoryMockCreateParams
paramPtrs *RequestRepositoryMockCreateParamPtrs
expectationOrigins RequestRepositoryMockCreateExpectationOrigins
results *RequestRepositoryMockCreateResults
returnOrigin string
Counter uint64
}
// RequestRepositoryMockCreateParams contains parameters of the RequestRepository.Create
type RequestRepositoryMockCreateParams struct {
ctx context.Context
req *model.Request
}
// RequestRepositoryMockCreateParamPtrs contains pointers to parameters of the RequestRepository.Create
type RequestRepositoryMockCreateParamPtrs struct {
ctx *context.Context
req **model.Request
}
// RequestRepositoryMockCreateResults contains results of the RequestRepository.Create
type RequestRepositoryMockCreateResults struct {
err error
}
// RequestRepositoryMockCreateOrigins contains origins of expectations of the RequestRepository.Create
type RequestRepositoryMockCreateExpectationOrigins struct {
origin string
originCtx string
originReq 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 (mmCreate *mRequestRepositoryMockCreate) Optional() *mRequestRepositoryMockCreate {
mmCreate.optional = true
return mmCreate
}
// Expect sets up expected params for RequestRepository.Create
func (mmCreate *mRequestRepositoryMockCreate) Expect(ctx context.Context, req *model.Request) *mRequestRepositoryMockCreate {
if mmCreate.mock.funcCreate != nil {
mmCreate.mock.t.Fatalf("RequestRepositoryMock.Create mock is already set by Set")
}
if mmCreate.defaultExpectation == nil {
mmCreate.defaultExpectation = &RequestRepositoryMockCreateExpectation{}
}
if mmCreate.defaultExpectation.paramPtrs != nil {
mmCreate.mock.t.Fatalf("RequestRepositoryMock.Create mock is already set by ExpectParams functions")
}
mmCreate.defaultExpectation.params = &RequestRepositoryMockCreateParams{ctx, req}
mmCreate.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmCreate.expectations {
if minimock.Equal(e.params, mmCreate.defaultExpectation.params) {
mmCreate.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCreate.defaultExpectation.params)
}
}
return mmCreate
}
// ExpectCtxParam1 sets up expected param ctx for RequestRepository.Create
func (mmCreate *mRequestRepositoryMockCreate) ExpectCtxParam1(ctx context.Context) *mRequestRepositoryMockCreate {
if mmCreate.mock.funcCreate != nil {
mmCreate.mock.t.Fatalf("RequestRepositoryMock.Create mock is already set by Set")
}
if mmCreate.defaultExpectation == nil {
mmCreate.defaultExpectation = &RequestRepositoryMockCreateExpectation{}
}
if mmCreate.defaultExpectation.params != nil {
mmCreate.mock.t.Fatalf("RequestRepositoryMock.Create mock is already set by Expect")
}
if mmCreate.defaultExpectation.paramPtrs == nil {
mmCreate.defaultExpectation.paramPtrs = &RequestRepositoryMockCreateParamPtrs{}
}
mmCreate.defaultExpectation.paramPtrs.ctx = &ctx
mmCreate.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmCreate
}
// ExpectReqParam2 sets up expected param req for RequestRepository.Create
func (mmCreate *mRequestRepositoryMockCreate) ExpectReqParam2(req *model.Request) *mRequestRepositoryMockCreate {
if mmCreate.mock.funcCreate != nil {
mmCreate.mock.t.Fatalf("RequestRepositoryMock.Create mock is already set by Set")
}
if mmCreate.defaultExpectation == nil {
mmCreate.defaultExpectation = &RequestRepositoryMockCreateExpectation{}
}
if mmCreate.defaultExpectation.params != nil {
mmCreate.mock.t.Fatalf("RequestRepositoryMock.Create mock is already set by Expect")
}
if mmCreate.defaultExpectation.paramPtrs == nil {
mmCreate.defaultExpectation.paramPtrs = &RequestRepositoryMockCreateParamPtrs{}
}
mmCreate.defaultExpectation.paramPtrs.req = &req
mmCreate.defaultExpectation.expectationOrigins.originReq = minimock.CallerInfo(1)
return mmCreate
}
// Inspect accepts an inspector function that has same arguments as the RequestRepository.Create
func (mmCreate *mRequestRepositoryMockCreate) Inspect(f func(ctx context.Context, req *model.Request)) *mRequestRepositoryMockCreate {
if mmCreate.mock.inspectFuncCreate != nil {
mmCreate.mock.t.Fatalf("Inspect function is already set for RequestRepositoryMock.Create")
}
mmCreate.mock.inspectFuncCreate = f
return mmCreate
}
// Return sets up results that will be returned by RequestRepository.Create
func (mmCreate *mRequestRepositoryMockCreate) Return(err error) *RequestRepositoryMock {
if mmCreate.mock.funcCreate != nil {
mmCreate.mock.t.Fatalf("RequestRepositoryMock.Create mock is already set by Set")
}
if mmCreate.defaultExpectation == nil {
mmCreate.defaultExpectation = &RequestRepositoryMockCreateExpectation{mock: mmCreate.mock}
}
mmCreate.defaultExpectation.results = &RequestRepositoryMockCreateResults{err}
mmCreate.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmCreate.mock
}
// Set uses given function f to mock the RequestRepository.Create method
func (mmCreate *mRequestRepositoryMockCreate) Set(f func(ctx context.Context, req *model.Request) (err error)) *RequestRepositoryMock {
if mmCreate.defaultExpectation != nil {
mmCreate.mock.t.Fatalf("Default expectation is already set for the RequestRepository.Create method")
}
if len(mmCreate.expectations) > 0 {
mmCreate.mock.t.Fatalf("Some expectations are already set for the RequestRepository.Create method")
}
mmCreate.mock.funcCreate = f
mmCreate.mock.funcCreateOrigin = minimock.CallerInfo(1)
return mmCreate.mock
}
// When sets expectation for the RequestRepository.Create which will trigger the result defined by the following
// Then helper
func (mmCreate *mRequestRepositoryMockCreate) When(ctx context.Context, req *model.Request) *RequestRepositoryMockCreateExpectation {
if mmCreate.mock.funcCreate != nil {
mmCreate.mock.t.Fatalf("RequestRepositoryMock.Create mock is already set by Set")
}
expectation := &RequestRepositoryMockCreateExpectation{
mock: mmCreate.mock,
params: &RequestRepositoryMockCreateParams{ctx, req},
expectationOrigins: RequestRepositoryMockCreateExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmCreate.expectations = append(mmCreate.expectations, expectation)
return expectation
}
// Then sets up RequestRepository.Create return parameters for the expectation previously defined by the When method
func (e *RequestRepositoryMockCreateExpectation) Then(err error) *RequestRepositoryMock {
e.results = &RequestRepositoryMockCreateResults{err}
return e.mock
}
// Times sets number of times RequestRepository.Create should be invoked
func (mmCreate *mRequestRepositoryMockCreate) Times(n uint64) *mRequestRepositoryMockCreate {
if n == 0 {
mmCreate.mock.t.Fatalf("Times of RequestRepositoryMock.Create mock can not be zero")
}
mm_atomic.StoreUint64(&mmCreate.expectedInvocations, n)
mmCreate.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmCreate
}
func (mmCreate *mRequestRepositoryMockCreate) invocationsDone() bool {
if len(mmCreate.expectations) == 0 && mmCreate.defaultExpectation == nil && mmCreate.mock.funcCreate == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmCreate.mock.afterCreateCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmCreate.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// Create implements mm_repository.RequestRepository
func (mmCreate *RequestRepositoryMock) Create(ctx context.Context, req *model.Request) (err error) {
mm_atomic.AddUint64(&mmCreate.beforeCreateCounter, 1)
defer mm_atomic.AddUint64(&mmCreate.afterCreateCounter, 1)
mmCreate.t.Helper()
if mmCreate.inspectFuncCreate != nil {
mmCreate.inspectFuncCreate(ctx, req)
}
mm_params := RequestRepositoryMockCreateParams{ctx, req}
// Record call args
mmCreate.CreateMock.mutex.Lock()
mmCreate.CreateMock.callArgs = append(mmCreate.CreateMock.callArgs, &mm_params)
mmCreate.CreateMock.mutex.Unlock()
for _, e := range mmCreate.CreateMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.err
}
}
if mmCreate.CreateMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmCreate.CreateMock.defaultExpectation.Counter, 1)
mm_want := mmCreate.CreateMock.defaultExpectation.params
mm_want_ptrs := mmCreate.CreateMock.defaultExpectation.paramPtrs
mm_got := RequestRepositoryMockCreateParams{ctx, req}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmCreate.t.Errorf("RequestRepositoryMock.Create got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCreate.CreateMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.req != nil && !minimock.Equal(*mm_want_ptrs.req, mm_got.req) {
mmCreate.t.Errorf("RequestRepositoryMock.Create got unexpected parameter req, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCreate.CreateMock.defaultExpectation.expectationOrigins.originReq, *mm_want_ptrs.req, mm_got.req, minimock.Diff(*mm_want_ptrs.req, mm_got.req))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmCreate.t.Errorf("RequestRepositoryMock.Create got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmCreate.CreateMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmCreate.CreateMock.defaultExpectation.results
if mm_results == nil {
mmCreate.t.Fatal("No results are set for the RequestRepositoryMock.Create")
}
return (*mm_results).err
}
if mmCreate.funcCreate != nil {
return mmCreate.funcCreate(ctx, req)
}
mmCreate.t.Fatalf("Unexpected call to RequestRepositoryMock.Create. %v %v", ctx, req)
return
}
// CreateAfterCounter returns a count of finished RequestRepositoryMock.Create invocations
func (mmCreate *RequestRepositoryMock) CreateAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmCreate.afterCreateCounter)
}
// CreateBeforeCounter returns a count of RequestRepositoryMock.Create invocations
func (mmCreate *RequestRepositoryMock) CreateBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmCreate.beforeCreateCounter)
}
// Calls returns a list of arguments used in each call to RequestRepositoryMock.Create.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmCreate *mRequestRepositoryMockCreate) Calls() []*RequestRepositoryMockCreateParams {
mmCreate.mutex.RLock()
argCopy := make([]*RequestRepositoryMockCreateParams, len(mmCreate.callArgs))
copy(argCopy, mmCreate.callArgs)
mmCreate.mutex.RUnlock()
return argCopy
}
// MinimockCreateDone returns true if the count of the Create invocations corresponds
// the number of defined expectations
func (m *RequestRepositoryMock) MinimockCreateDone() bool {
if m.CreateMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.CreateMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.CreateMock.invocationsDone()
}
// MinimockCreateInspect logs each unmet expectation
func (m *RequestRepositoryMock) MinimockCreateInspect() {
for _, e := range m.CreateMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.Create at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterCreateCounter := mm_atomic.LoadUint64(&m.afterCreateCounter)
// if default expectation was set then invocations count should be greater than zero
if m.CreateMock.defaultExpectation != nil && afterCreateCounter < 1 {
if m.CreateMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestRepositoryMock.Create at\n%s", m.CreateMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestRepositoryMock.Create at\n%s with params: %#v", m.CreateMock.defaultExpectation.expectationOrigins.origin, *m.CreateMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcCreate != nil && afterCreateCounter < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.Create at\n%s", m.funcCreateOrigin)
}
if !m.CreateMock.invocationsDone() && afterCreateCounter > 0 {
m.t.Errorf("Expected %d calls to RequestRepositoryMock.Create at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.CreateMock.expectedInvocations), m.CreateMock.expectedInvocationsOrigin, afterCreateCounter)
}
}
type mRequestRepositoryMockGetByID struct {
optional bool
mock *RequestRepositoryMock
defaultExpectation *RequestRepositoryMockGetByIDExpectation
expectations []*RequestRepositoryMockGetByIDExpectation
callArgs []*RequestRepositoryMockGetByIDParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestRepositoryMockGetByIDExpectation specifies expectation struct of the RequestRepository.GetByID
type RequestRepositoryMockGetByIDExpectation struct {
mock *RequestRepositoryMock
params *RequestRepositoryMockGetByIDParams
paramPtrs *RequestRepositoryMockGetByIDParamPtrs
expectationOrigins RequestRepositoryMockGetByIDExpectationOrigins
results *RequestRepositoryMockGetByIDResults
returnOrigin string
Counter uint64
}
// RequestRepositoryMockGetByIDParams contains parameters of the RequestRepository.GetByID
type RequestRepositoryMockGetByIDParams struct {
ctx context.Context
id uuid.UUID
}
// RequestRepositoryMockGetByIDParamPtrs contains pointers to parameters of the RequestRepository.GetByID
type RequestRepositoryMockGetByIDParamPtrs struct {
ctx *context.Context
id *uuid.UUID
}
// RequestRepositoryMockGetByIDResults contains results of the RequestRepository.GetByID
type RequestRepositoryMockGetByIDResults struct {
rp1 *model.Request
err error
}
// RequestRepositoryMockGetByIDOrigins contains origins of expectations of the RequestRepository.GetByID
type RequestRepositoryMockGetByIDExpectationOrigins struct {
origin string
originCtx string
originId 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 (mmGetByID *mRequestRepositoryMockGetByID) Optional() *mRequestRepositoryMockGetByID {
mmGetByID.optional = true
return mmGetByID
}
// Expect sets up expected params for RequestRepository.GetByID
func (mmGetByID *mRequestRepositoryMockGetByID) Expect(ctx context.Context, id uuid.UUID) *mRequestRepositoryMockGetByID {
if mmGetByID.mock.funcGetByID != nil {
mmGetByID.mock.t.Fatalf("RequestRepositoryMock.GetByID mock is already set by Set")
}
if mmGetByID.defaultExpectation == nil {
mmGetByID.defaultExpectation = &RequestRepositoryMockGetByIDExpectation{}
}
if mmGetByID.defaultExpectation.paramPtrs != nil {
mmGetByID.mock.t.Fatalf("RequestRepositoryMock.GetByID mock is already set by ExpectParams functions")
}
mmGetByID.defaultExpectation.params = &RequestRepositoryMockGetByIDParams{ctx, id}
mmGetByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmGetByID.expectations {
if minimock.Equal(e.params, mmGetByID.defaultExpectation.params) {
mmGetByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByID.defaultExpectation.params)
}
}
return mmGetByID
}
// ExpectCtxParam1 sets up expected param ctx for RequestRepository.GetByID
func (mmGetByID *mRequestRepositoryMockGetByID) ExpectCtxParam1(ctx context.Context) *mRequestRepositoryMockGetByID {
if mmGetByID.mock.funcGetByID != nil {
mmGetByID.mock.t.Fatalf("RequestRepositoryMock.GetByID mock is already set by Set")
}
if mmGetByID.defaultExpectation == nil {
mmGetByID.defaultExpectation = &RequestRepositoryMockGetByIDExpectation{}
}
if mmGetByID.defaultExpectation.params != nil {
mmGetByID.mock.t.Fatalf("RequestRepositoryMock.GetByID mock is already set by Expect")
}
if mmGetByID.defaultExpectation.paramPtrs == nil {
mmGetByID.defaultExpectation.paramPtrs = &RequestRepositoryMockGetByIDParamPtrs{}
}
mmGetByID.defaultExpectation.paramPtrs.ctx = &ctx
mmGetByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmGetByID
}
// ExpectIdParam2 sets up expected param id for RequestRepository.GetByID
func (mmGetByID *mRequestRepositoryMockGetByID) ExpectIdParam2(id uuid.UUID) *mRequestRepositoryMockGetByID {
if mmGetByID.mock.funcGetByID != nil {
mmGetByID.mock.t.Fatalf("RequestRepositoryMock.GetByID mock is already set by Set")
}
if mmGetByID.defaultExpectation == nil {
mmGetByID.defaultExpectation = &RequestRepositoryMockGetByIDExpectation{}
}
if mmGetByID.defaultExpectation.params != nil {
mmGetByID.mock.t.Fatalf("RequestRepositoryMock.GetByID mock is already set by Expect")
}
if mmGetByID.defaultExpectation.paramPtrs == nil {
mmGetByID.defaultExpectation.paramPtrs = &RequestRepositoryMockGetByIDParamPtrs{}
}
mmGetByID.defaultExpectation.paramPtrs.id = &id
mmGetByID.defaultExpectation.expectationOrigins.originId = minimock.CallerInfo(1)
return mmGetByID
}
// Inspect accepts an inspector function that has same arguments as the RequestRepository.GetByID
func (mmGetByID *mRequestRepositoryMockGetByID) Inspect(f func(ctx context.Context, id uuid.UUID)) *mRequestRepositoryMockGetByID {
if mmGetByID.mock.inspectFuncGetByID != nil {
mmGetByID.mock.t.Fatalf("Inspect function is already set for RequestRepositoryMock.GetByID")
}
mmGetByID.mock.inspectFuncGetByID = f
return mmGetByID
}
// Return sets up results that will be returned by RequestRepository.GetByID
func (mmGetByID *mRequestRepositoryMockGetByID) Return(rp1 *model.Request, err error) *RequestRepositoryMock {
if mmGetByID.mock.funcGetByID != nil {
mmGetByID.mock.t.Fatalf("RequestRepositoryMock.GetByID mock is already set by Set")
}
if mmGetByID.defaultExpectation == nil {
mmGetByID.defaultExpectation = &RequestRepositoryMockGetByIDExpectation{mock: mmGetByID.mock}
}
mmGetByID.defaultExpectation.results = &RequestRepositoryMockGetByIDResults{rp1, err}
mmGetByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmGetByID.mock
}
// Set uses given function f to mock the RequestRepository.GetByID method
func (mmGetByID *mRequestRepositoryMockGetByID) Set(f func(ctx context.Context, id uuid.UUID) (rp1 *model.Request, err error)) *RequestRepositoryMock {
if mmGetByID.defaultExpectation != nil {
mmGetByID.mock.t.Fatalf("Default expectation is already set for the RequestRepository.GetByID method")
}
if len(mmGetByID.expectations) > 0 {
mmGetByID.mock.t.Fatalf("Some expectations are already set for the RequestRepository.GetByID method")
}
mmGetByID.mock.funcGetByID = f
mmGetByID.mock.funcGetByIDOrigin = minimock.CallerInfo(1)
return mmGetByID.mock
}
// When sets expectation for the RequestRepository.GetByID which will trigger the result defined by the following
// Then helper
func (mmGetByID *mRequestRepositoryMockGetByID) When(ctx context.Context, id uuid.UUID) *RequestRepositoryMockGetByIDExpectation {
if mmGetByID.mock.funcGetByID != nil {
mmGetByID.mock.t.Fatalf("RequestRepositoryMock.GetByID mock is already set by Set")
}
expectation := &RequestRepositoryMockGetByIDExpectation{
mock: mmGetByID.mock,
params: &RequestRepositoryMockGetByIDParams{ctx, id},
expectationOrigins: RequestRepositoryMockGetByIDExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmGetByID.expectations = append(mmGetByID.expectations, expectation)
return expectation
}
// Then sets up RequestRepository.GetByID return parameters for the expectation previously defined by the When method
func (e *RequestRepositoryMockGetByIDExpectation) Then(rp1 *model.Request, err error) *RequestRepositoryMock {
e.results = &RequestRepositoryMockGetByIDResults{rp1, err}
return e.mock
}
// Times sets number of times RequestRepository.GetByID should be invoked
func (mmGetByID *mRequestRepositoryMockGetByID) Times(n uint64) *mRequestRepositoryMockGetByID {
if n == 0 {
mmGetByID.mock.t.Fatalf("Times of RequestRepositoryMock.GetByID mock can not be zero")
}
mm_atomic.StoreUint64(&mmGetByID.expectedInvocations, n)
mmGetByID.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmGetByID
}
func (mmGetByID *mRequestRepositoryMockGetByID) invocationsDone() bool {
if len(mmGetByID.expectations) == 0 && mmGetByID.defaultExpectation == nil && mmGetByID.mock.funcGetByID == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmGetByID.mock.afterGetByIDCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmGetByID.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// GetByID implements mm_repository.RequestRepository
func (mmGetByID *RequestRepositoryMock) GetByID(ctx context.Context, id uuid.UUID) (rp1 *model.Request, err error) {
mm_atomic.AddUint64(&mmGetByID.beforeGetByIDCounter, 1)
defer mm_atomic.AddUint64(&mmGetByID.afterGetByIDCounter, 1)
mmGetByID.t.Helper()
if mmGetByID.inspectFuncGetByID != nil {
mmGetByID.inspectFuncGetByID(ctx, id)
}
mm_params := RequestRepositoryMockGetByIDParams{ctx, id}
// Record call args
mmGetByID.GetByIDMock.mutex.Lock()
mmGetByID.GetByIDMock.callArgs = append(mmGetByID.GetByIDMock.callArgs, &mm_params)
mmGetByID.GetByIDMock.mutex.Unlock()
for _, e := range mmGetByID.GetByIDMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.rp1, e.results.err
}
}
if mmGetByID.GetByIDMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmGetByID.GetByIDMock.defaultExpectation.Counter, 1)
mm_want := mmGetByID.GetByIDMock.defaultExpectation.params
mm_want_ptrs := mmGetByID.GetByIDMock.defaultExpectation.paramPtrs
mm_got := RequestRepositoryMockGetByIDParams{ctx, id}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmGetByID.t.Errorf("RequestRepositoryMock.GetByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetByID.GetByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
mmGetByID.t.Errorf("RequestRepositoryMock.GetByID got unexpected parameter id, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetByID.GetByIDMock.defaultExpectation.expectationOrigins.originId, *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmGetByID.t.Errorf("RequestRepositoryMock.GetByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetByID.GetByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmGetByID.GetByIDMock.defaultExpectation.results
if mm_results == nil {
mmGetByID.t.Fatal("No results are set for the RequestRepositoryMock.GetByID")
}
return (*mm_results).rp1, (*mm_results).err
}
if mmGetByID.funcGetByID != nil {
return mmGetByID.funcGetByID(ctx, id)
}
mmGetByID.t.Fatalf("Unexpected call to RequestRepositoryMock.GetByID. %v %v", ctx, id)
return
}
// GetByIDAfterCounter returns a count of finished RequestRepositoryMock.GetByID invocations
func (mmGetByID *RequestRepositoryMock) GetByIDAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetByID.afterGetByIDCounter)
}
// GetByIDBeforeCounter returns a count of RequestRepositoryMock.GetByID invocations
func (mmGetByID *RequestRepositoryMock) GetByIDBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetByID.beforeGetByIDCounter)
}
// Calls returns a list of arguments used in each call to RequestRepositoryMock.GetByID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmGetByID *mRequestRepositoryMockGetByID) Calls() []*RequestRepositoryMockGetByIDParams {
mmGetByID.mutex.RLock()
argCopy := make([]*RequestRepositoryMockGetByIDParams, len(mmGetByID.callArgs))
copy(argCopy, mmGetByID.callArgs)
mmGetByID.mutex.RUnlock()
return argCopy
}
// MinimockGetByIDDone returns true if the count of the GetByID invocations corresponds
// the number of defined expectations
func (m *RequestRepositoryMock) MinimockGetByIDDone() bool {
if m.GetByIDMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.GetByIDMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.GetByIDMock.invocationsDone()
}
// MinimockGetByIDInspect logs each unmet expectation
func (m *RequestRepositoryMock) MinimockGetByIDInspect() {
for _, e := range m.GetByIDMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.GetByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterGetByIDCounter := mm_atomic.LoadUint64(&m.afterGetByIDCounter)
// if default expectation was set then invocations count should be greater than zero
if m.GetByIDMock.defaultExpectation != nil && afterGetByIDCounter < 1 {
if m.GetByIDMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestRepositoryMock.GetByID at\n%s", m.GetByIDMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestRepositoryMock.GetByID at\n%s with params: %#v", m.GetByIDMock.defaultExpectation.expectationOrigins.origin, *m.GetByIDMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcGetByID != nil && afterGetByIDCounter < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.GetByID at\n%s", m.funcGetByIDOrigin)
}
if !m.GetByIDMock.invocationsDone() && afterGetByIDCounter > 0 {
m.t.Errorf("Expected %d calls to RequestRepositoryMock.GetByID at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.GetByIDMock.expectedInvocations), m.GetByIDMock.expectedInvocationsOrigin, afterGetByIDCounter)
}
}
type mRequestRepositoryMockGetByUserID struct {
optional bool
mock *RequestRepositoryMock
defaultExpectation *RequestRepositoryMockGetByUserIDExpectation
expectations []*RequestRepositoryMockGetByUserIDExpectation
callArgs []*RequestRepositoryMockGetByUserIDParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestRepositoryMockGetByUserIDExpectation specifies expectation struct of the RequestRepository.GetByUserID
type RequestRepositoryMockGetByUserIDExpectation struct {
mock *RequestRepositoryMock
params *RequestRepositoryMockGetByUserIDParams
paramPtrs *RequestRepositoryMockGetByUserIDParamPtrs
expectationOrigins RequestRepositoryMockGetByUserIDExpectationOrigins
results *RequestRepositoryMockGetByUserIDResults
returnOrigin string
Counter uint64
}
// RequestRepositoryMockGetByUserIDParams contains parameters of the RequestRepository.GetByUserID
type RequestRepositoryMockGetByUserIDParams struct {
ctx context.Context
userID int
}
// RequestRepositoryMockGetByUserIDParamPtrs contains pointers to parameters of the RequestRepository.GetByUserID
type RequestRepositoryMockGetByUserIDParamPtrs struct {
ctx *context.Context
userID *int
}
// RequestRepositoryMockGetByUserIDResults contains results of the RequestRepository.GetByUserID
type RequestRepositoryMockGetByUserIDResults struct {
rpa1 []*model.Request
err error
}
// RequestRepositoryMockGetByUserIDOrigins contains origins of expectations of the RequestRepository.GetByUserID
type RequestRepositoryMockGetByUserIDExpectationOrigins 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 (mmGetByUserID *mRequestRepositoryMockGetByUserID) Optional() *mRequestRepositoryMockGetByUserID {
mmGetByUserID.optional = true
return mmGetByUserID
}
// Expect sets up expected params for RequestRepository.GetByUserID
func (mmGetByUserID *mRequestRepositoryMockGetByUserID) Expect(ctx context.Context, userID int) *mRequestRepositoryMockGetByUserID {
if mmGetByUserID.mock.funcGetByUserID != nil {
mmGetByUserID.mock.t.Fatalf("RequestRepositoryMock.GetByUserID mock is already set by Set")
}
if mmGetByUserID.defaultExpectation == nil {
mmGetByUserID.defaultExpectation = &RequestRepositoryMockGetByUserIDExpectation{}
}
if mmGetByUserID.defaultExpectation.paramPtrs != nil {
mmGetByUserID.mock.t.Fatalf("RequestRepositoryMock.GetByUserID mock is already set by ExpectParams functions")
}
mmGetByUserID.defaultExpectation.params = &RequestRepositoryMockGetByUserIDParams{ctx, userID}
mmGetByUserID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmGetByUserID.expectations {
if minimock.Equal(e.params, mmGetByUserID.defaultExpectation.params) {
mmGetByUserID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByUserID.defaultExpectation.params)
}
}
return mmGetByUserID
}
// ExpectCtxParam1 sets up expected param ctx for RequestRepository.GetByUserID
func (mmGetByUserID *mRequestRepositoryMockGetByUserID) ExpectCtxParam1(ctx context.Context) *mRequestRepositoryMockGetByUserID {
if mmGetByUserID.mock.funcGetByUserID != nil {
mmGetByUserID.mock.t.Fatalf("RequestRepositoryMock.GetByUserID mock is already set by Set")
}
if mmGetByUserID.defaultExpectation == nil {
mmGetByUserID.defaultExpectation = &RequestRepositoryMockGetByUserIDExpectation{}
}
if mmGetByUserID.defaultExpectation.params != nil {
mmGetByUserID.mock.t.Fatalf("RequestRepositoryMock.GetByUserID mock is already set by Expect")
}
if mmGetByUserID.defaultExpectation.paramPtrs == nil {
mmGetByUserID.defaultExpectation.paramPtrs = &RequestRepositoryMockGetByUserIDParamPtrs{}
}
mmGetByUserID.defaultExpectation.paramPtrs.ctx = &ctx
mmGetByUserID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmGetByUserID
}
// ExpectUserIDParam2 sets up expected param userID for RequestRepository.GetByUserID
func (mmGetByUserID *mRequestRepositoryMockGetByUserID) ExpectUserIDParam2(userID int) *mRequestRepositoryMockGetByUserID {
if mmGetByUserID.mock.funcGetByUserID != nil {
mmGetByUserID.mock.t.Fatalf("RequestRepositoryMock.GetByUserID mock is already set by Set")
}
if mmGetByUserID.defaultExpectation == nil {
mmGetByUserID.defaultExpectation = &RequestRepositoryMockGetByUserIDExpectation{}
}
if mmGetByUserID.defaultExpectation.params != nil {
mmGetByUserID.mock.t.Fatalf("RequestRepositoryMock.GetByUserID mock is already set by Expect")
}
if mmGetByUserID.defaultExpectation.paramPtrs == nil {
mmGetByUserID.defaultExpectation.paramPtrs = &RequestRepositoryMockGetByUserIDParamPtrs{}
}
mmGetByUserID.defaultExpectation.paramPtrs.userID = &userID
mmGetByUserID.defaultExpectation.expectationOrigins.originUserID = minimock.CallerInfo(1)
return mmGetByUserID
}
// Inspect accepts an inspector function that has same arguments as the RequestRepository.GetByUserID
func (mmGetByUserID *mRequestRepositoryMockGetByUserID) Inspect(f func(ctx context.Context, userID int)) *mRequestRepositoryMockGetByUserID {
if mmGetByUserID.mock.inspectFuncGetByUserID != nil {
mmGetByUserID.mock.t.Fatalf("Inspect function is already set for RequestRepositoryMock.GetByUserID")
}
mmGetByUserID.mock.inspectFuncGetByUserID = f
return mmGetByUserID
}
// Return sets up results that will be returned by RequestRepository.GetByUserID
func (mmGetByUserID *mRequestRepositoryMockGetByUserID) Return(rpa1 []*model.Request, err error) *RequestRepositoryMock {
if mmGetByUserID.mock.funcGetByUserID != nil {
mmGetByUserID.mock.t.Fatalf("RequestRepositoryMock.GetByUserID mock is already set by Set")
}
if mmGetByUserID.defaultExpectation == nil {
mmGetByUserID.defaultExpectation = &RequestRepositoryMockGetByUserIDExpectation{mock: mmGetByUserID.mock}
}
mmGetByUserID.defaultExpectation.results = &RequestRepositoryMockGetByUserIDResults{rpa1, err}
mmGetByUserID.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmGetByUserID.mock
}
// Set uses given function f to mock the RequestRepository.GetByUserID method
func (mmGetByUserID *mRequestRepositoryMockGetByUserID) Set(f func(ctx context.Context, userID int) (rpa1 []*model.Request, err error)) *RequestRepositoryMock {
if mmGetByUserID.defaultExpectation != nil {
mmGetByUserID.mock.t.Fatalf("Default expectation is already set for the RequestRepository.GetByUserID method")
}
if len(mmGetByUserID.expectations) > 0 {
mmGetByUserID.mock.t.Fatalf("Some expectations are already set for the RequestRepository.GetByUserID method")
}
mmGetByUserID.mock.funcGetByUserID = f
mmGetByUserID.mock.funcGetByUserIDOrigin = minimock.CallerInfo(1)
return mmGetByUserID.mock
}
// When sets expectation for the RequestRepository.GetByUserID which will trigger the result defined by the following
// Then helper
func (mmGetByUserID *mRequestRepositoryMockGetByUserID) When(ctx context.Context, userID int) *RequestRepositoryMockGetByUserIDExpectation {
if mmGetByUserID.mock.funcGetByUserID != nil {
mmGetByUserID.mock.t.Fatalf("RequestRepositoryMock.GetByUserID mock is already set by Set")
}
expectation := &RequestRepositoryMockGetByUserIDExpectation{
mock: mmGetByUserID.mock,
params: &RequestRepositoryMockGetByUserIDParams{ctx, userID},
expectationOrigins: RequestRepositoryMockGetByUserIDExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmGetByUserID.expectations = append(mmGetByUserID.expectations, expectation)
return expectation
}
// Then sets up RequestRepository.GetByUserID return parameters for the expectation previously defined by the When method
func (e *RequestRepositoryMockGetByUserIDExpectation) Then(rpa1 []*model.Request, err error) *RequestRepositoryMock {
e.results = &RequestRepositoryMockGetByUserIDResults{rpa1, err}
return e.mock
}
// Times sets number of times RequestRepository.GetByUserID should be invoked
func (mmGetByUserID *mRequestRepositoryMockGetByUserID) Times(n uint64) *mRequestRepositoryMockGetByUserID {
if n == 0 {
mmGetByUserID.mock.t.Fatalf("Times of RequestRepositoryMock.GetByUserID mock can not be zero")
}
mm_atomic.StoreUint64(&mmGetByUserID.expectedInvocations, n)
mmGetByUserID.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmGetByUserID
}
func (mmGetByUserID *mRequestRepositoryMockGetByUserID) invocationsDone() bool {
if len(mmGetByUserID.expectations) == 0 && mmGetByUserID.defaultExpectation == nil && mmGetByUserID.mock.funcGetByUserID == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmGetByUserID.mock.afterGetByUserIDCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmGetByUserID.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// GetByUserID implements mm_repository.RequestRepository
func (mmGetByUserID *RequestRepositoryMock) GetByUserID(ctx context.Context, userID int) (rpa1 []*model.Request, err error) {
mm_atomic.AddUint64(&mmGetByUserID.beforeGetByUserIDCounter, 1)
defer mm_atomic.AddUint64(&mmGetByUserID.afterGetByUserIDCounter, 1)
mmGetByUserID.t.Helper()
if mmGetByUserID.inspectFuncGetByUserID != nil {
mmGetByUserID.inspectFuncGetByUserID(ctx, userID)
}
mm_params := RequestRepositoryMockGetByUserIDParams{ctx, userID}
// Record call args
mmGetByUserID.GetByUserIDMock.mutex.Lock()
mmGetByUserID.GetByUserIDMock.callArgs = append(mmGetByUserID.GetByUserIDMock.callArgs, &mm_params)
mmGetByUserID.GetByUserIDMock.mutex.Unlock()
for _, e := range mmGetByUserID.GetByUserIDMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.rpa1, e.results.err
}
}
if mmGetByUserID.GetByUserIDMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmGetByUserID.GetByUserIDMock.defaultExpectation.Counter, 1)
mm_want := mmGetByUserID.GetByUserIDMock.defaultExpectation.params
mm_want_ptrs := mmGetByUserID.GetByUserIDMock.defaultExpectation.paramPtrs
mm_got := RequestRepositoryMockGetByUserIDParams{ctx, userID}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmGetByUserID.t.Errorf("RequestRepositoryMock.GetByUserID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetByUserID.GetByUserIDMock.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) {
mmGetByUserID.t.Errorf("RequestRepositoryMock.GetByUserID got unexpected parameter userID, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetByUserID.GetByUserIDMock.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) {
mmGetByUserID.t.Errorf("RequestRepositoryMock.GetByUserID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetByUserID.GetByUserIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmGetByUserID.GetByUserIDMock.defaultExpectation.results
if mm_results == nil {
mmGetByUserID.t.Fatal("No results are set for the RequestRepositoryMock.GetByUserID")
}
return (*mm_results).rpa1, (*mm_results).err
}
if mmGetByUserID.funcGetByUserID != nil {
return mmGetByUserID.funcGetByUserID(ctx, userID)
}
mmGetByUserID.t.Fatalf("Unexpected call to RequestRepositoryMock.GetByUserID. %v %v", ctx, userID)
return
}
// GetByUserIDAfterCounter returns a count of finished RequestRepositoryMock.GetByUserID invocations
func (mmGetByUserID *RequestRepositoryMock) GetByUserIDAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetByUserID.afterGetByUserIDCounter)
}
// GetByUserIDBeforeCounter returns a count of RequestRepositoryMock.GetByUserID invocations
func (mmGetByUserID *RequestRepositoryMock) GetByUserIDBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetByUserID.beforeGetByUserIDCounter)
}
// Calls returns a list of arguments used in each call to RequestRepositoryMock.GetByUserID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmGetByUserID *mRequestRepositoryMockGetByUserID) Calls() []*RequestRepositoryMockGetByUserIDParams {
mmGetByUserID.mutex.RLock()
argCopy := make([]*RequestRepositoryMockGetByUserIDParams, len(mmGetByUserID.callArgs))
copy(argCopy, mmGetByUserID.callArgs)
mmGetByUserID.mutex.RUnlock()
return argCopy
}
// MinimockGetByUserIDDone returns true if the count of the GetByUserID invocations corresponds
// the number of defined expectations
func (m *RequestRepositoryMock) MinimockGetByUserIDDone() bool {
if m.GetByUserIDMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.GetByUserIDMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.GetByUserIDMock.invocationsDone()
}
// MinimockGetByUserIDInspect logs each unmet expectation
func (m *RequestRepositoryMock) MinimockGetByUserIDInspect() {
for _, e := range m.GetByUserIDMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.GetByUserID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterGetByUserIDCounter := mm_atomic.LoadUint64(&m.afterGetByUserIDCounter)
// if default expectation was set then invocations count should be greater than zero
if m.GetByUserIDMock.defaultExpectation != nil && afterGetByUserIDCounter < 1 {
if m.GetByUserIDMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestRepositoryMock.GetByUserID at\n%s", m.GetByUserIDMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestRepositoryMock.GetByUserID at\n%s with params: %#v", m.GetByUserIDMock.defaultExpectation.expectationOrigins.origin, *m.GetByUserIDMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcGetByUserID != nil && afterGetByUserIDCounter < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.GetByUserID at\n%s", m.funcGetByUserIDOrigin)
}
if !m.GetByUserIDMock.invocationsDone() && afterGetByUserIDCounter > 0 {
m.t.Errorf("Expected %d calls to RequestRepositoryMock.GetByUserID at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.GetByUserIDMock.expectedInvocations), m.GetByUserIDMock.expectedInvocationsOrigin, afterGetByUserIDCounter)
}
}
type mRequestRepositoryMockGetDetailByID struct {
optional bool
mock *RequestRepositoryMock
defaultExpectation *RequestRepositoryMockGetDetailByIDExpectation
expectations []*RequestRepositoryMockGetDetailByIDExpectation
callArgs []*RequestRepositoryMockGetDetailByIDParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestRepositoryMockGetDetailByIDExpectation specifies expectation struct of the RequestRepository.GetDetailByID
type RequestRepositoryMockGetDetailByIDExpectation struct {
mock *RequestRepositoryMock
params *RequestRepositoryMockGetDetailByIDParams
paramPtrs *RequestRepositoryMockGetDetailByIDParamPtrs
expectationOrigins RequestRepositoryMockGetDetailByIDExpectationOrigins
results *RequestRepositoryMockGetDetailByIDResults
returnOrigin string
Counter uint64
}
// RequestRepositoryMockGetDetailByIDParams contains parameters of the RequestRepository.GetDetailByID
type RequestRepositoryMockGetDetailByIDParams struct {
ctx context.Context
id uuid.UUID
}
// RequestRepositoryMockGetDetailByIDParamPtrs contains pointers to parameters of the RequestRepository.GetDetailByID
type RequestRepositoryMockGetDetailByIDParamPtrs struct {
ctx *context.Context
id *uuid.UUID
}
// RequestRepositoryMockGetDetailByIDResults contains results of the RequestRepository.GetDetailByID
type RequestRepositoryMockGetDetailByIDResults struct {
rp1 *model.RequestDetail
err error
}
// RequestRepositoryMockGetDetailByIDOrigins contains origins of expectations of the RequestRepository.GetDetailByID
type RequestRepositoryMockGetDetailByIDExpectationOrigins struct {
origin string
originCtx string
originId 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 (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) Optional() *mRequestRepositoryMockGetDetailByID {
mmGetDetailByID.optional = true
return mmGetDetailByID
}
// Expect sets up expected params for RequestRepository.GetDetailByID
func (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) Expect(ctx context.Context, id uuid.UUID) *mRequestRepositoryMockGetDetailByID {
if mmGetDetailByID.mock.funcGetDetailByID != nil {
mmGetDetailByID.mock.t.Fatalf("RequestRepositoryMock.GetDetailByID mock is already set by Set")
}
if mmGetDetailByID.defaultExpectation == nil {
mmGetDetailByID.defaultExpectation = &RequestRepositoryMockGetDetailByIDExpectation{}
}
if mmGetDetailByID.defaultExpectation.paramPtrs != nil {
mmGetDetailByID.mock.t.Fatalf("RequestRepositoryMock.GetDetailByID mock is already set by ExpectParams functions")
}
mmGetDetailByID.defaultExpectation.params = &RequestRepositoryMockGetDetailByIDParams{ctx, id}
mmGetDetailByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmGetDetailByID.expectations {
if minimock.Equal(e.params, mmGetDetailByID.defaultExpectation.params) {
mmGetDetailByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetDetailByID.defaultExpectation.params)
}
}
return mmGetDetailByID
}
// ExpectCtxParam1 sets up expected param ctx for RequestRepository.GetDetailByID
func (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) ExpectCtxParam1(ctx context.Context) *mRequestRepositoryMockGetDetailByID {
if mmGetDetailByID.mock.funcGetDetailByID != nil {
mmGetDetailByID.mock.t.Fatalf("RequestRepositoryMock.GetDetailByID mock is already set by Set")
}
if mmGetDetailByID.defaultExpectation == nil {
mmGetDetailByID.defaultExpectation = &RequestRepositoryMockGetDetailByIDExpectation{}
}
if mmGetDetailByID.defaultExpectation.params != nil {
mmGetDetailByID.mock.t.Fatalf("RequestRepositoryMock.GetDetailByID mock is already set by Expect")
}
if mmGetDetailByID.defaultExpectation.paramPtrs == nil {
mmGetDetailByID.defaultExpectation.paramPtrs = &RequestRepositoryMockGetDetailByIDParamPtrs{}
}
mmGetDetailByID.defaultExpectation.paramPtrs.ctx = &ctx
mmGetDetailByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmGetDetailByID
}
// ExpectIdParam2 sets up expected param id for RequestRepository.GetDetailByID
func (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) ExpectIdParam2(id uuid.UUID) *mRequestRepositoryMockGetDetailByID {
if mmGetDetailByID.mock.funcGetDetailByID != nil {
mmGetDetailByID.mock.t.Fatalf("RequestRepositoryMock.GetDetailByID mock is already set by Set")
}
if mmGetDetailByID.defaultExpectation == nil {
mmGetDetailByID.defaultExpectation = &RequestRepositoryMockGetDetailByIDExpectation{}
}
if mmGetDetailByID.defaultExpectation.params != nil {
mmGetDetailByID.mock.t.Fatalf("RequestRepositoryMock.GetDetailByID mock is already set by Expect")
}
if mmGetDetailByID.defaultExpectation.paramPtrs == nil {
mmGetDetailByID.defaultExpectation.paramPtrs = &RequestRepositoryMockGetDetailByIDParamPtrs{}
}
mmGetDetailByID.defaultExpectation.paramPtrs.id = &id
mmGetDetailByID.defaultExpectation.expectationOrigins.originId = minimock.CallerInfo(1)
return mmGetDetailByID
}
// Inspect accepts an inspector function that has same arguments as the RequestRepository.GetDetailByID
func (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) Inspect(f func(ctx context.Context, id uuid.UUID)) *mRequestRepositoryMockGetDetailByID {
if mmGetDetailByID.mock.inspectFuncGetDetailByID != nil {
mmGetDetailByID.mock.t.Fatalf("Inspect function is already set for RequestRepositoryMock.GetDetailByID")
}
mmGetDetailByID.mock.inspectFuncGetDetailByID = f
return mmGetDetailByID
}
// Return sets up results that will be returned by RequestRepository.GetDetailByID
func (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) Return(rp1 *model.RequestDetail, err error) *RequestRepositoryMock {
if mmGetDetailByID.mock.funcGetDetailByID != nil {
mmGetDetailByID.mock.t.Fatalf("RequestRepositoryMock.GetDetailByID mock is already set by Set")
}
if mmGetDetailByID.defaultExpectation == nil {
mmGetDetailByID.defaultExpectation = &RequestRepositoryMockGetDetailByIDExpectation{mock: mmGetDetailByID.mock}
}
mmGetDetailByID.defaultExpectation.results = &RequestRepositoryMockGetDetailByIDResults{rp1, err}
mmGetDetailByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmGetDetailByID.mock
}
// Set uses given function f to mock the RequestRepository.GetDetailByID method
func (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) Set(f func(ctx context.Context, id uuid.UUID) (rp1 *model.RequestDetail, err error)) *RequestRepositoryMock {
if mmGetDetailByID.defaultExpectation != nil {
mmGetDetailByID.mock.t.Fatalf("Default expectation is already set for the RequestRepository.GetDetailByID method")
}
if len(mmGetDetailByID.expectations) > 0 {
mmGetDetailByID.mock.t.Fatalf("Some expectations are already set for the RequestRepository.GetDetailByID method")
}
mmGetDetailByID.mock.funcGetDetailByID = f
mmGetDetailByID.mock.funcGetDetailByIDOrigin = minimock.CallerInfo(1)
return mmGetDetailByID.mock
}
// When sets expectation for the RequestRepository.GetDetailByID which will trigger the result defined by the following
// Then helper
func (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) When(ctx context.Context, id uuid.UUID) *RequestRepositoryMockGetDetailByIDExpectation {
if mmGetDetailByID.mock.funcGetDetailByID != nil {
mmGetDetailByID.mock.t.Fatalf("RequestRepositoryMock.GetDetailByID mock is already set by Set")
}
expectation := &RequestRepositoryMockGetDetailByIDExpectation{
mock: mmGetDetailByID.mock,
params: &RequestRepositoryMockGetDetailByIDParams{ctx, id},
expectationOrigins: RequestRepositoryMockGetDetailByIDExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmGetDetailByID.expectations = append(mmGetDetailByID.expectations, expectation)
return expectation
}
// Then sets up RequestRepository.GetDetailByID return parameters for the expectation previously defined by the When method
func (e *RequestRepositoryMockGetDetailByIDExpectation) Then(rp1 *model.RequestDetail, err error) *RequestRepositoryMock {
e.results = &RequestRepositoryMockGetDetailByIDResults{rp1, err}
return e.mock
}
// Times sets number of times RequestRepository.GetDetailByID should be invoked
func (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) Times(n uint64) *mRequestRepositoryMockGetDetailByID {
if n == 0 {
mmGetDetailByID.mock.t.Fatalf("Times of RequestRepositoryMock.GetDetailByID mock can not be zero")
}
mm_atomic.StoreUint64(&mmGetDetailByID.expectedInvocations, n)
mmGetDetailByID.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmGetDetailByID
}
func (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) invocationsDone() bool {
if len(mmGetDetailByID.expectations) == 0 && mmGetDetailByID.defaultExpectation == nil && mmGetDetailByID.mock.funcGetDetailByID == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmGetDetailByID.mock.afterGetDetailByIDCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmGetDetailByID.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// GetDetailByID implements mm_repository.RequestRepository
func (mmGetDetailByID *RequestRepositoryMock) GetDetailByID(ctx context.Context, id uuid.UUID) (rp1 *model.RequestDetail, err error) {
mm_atomic.AddUint64(&mmGetDetailByID.beforeGetDetailByIDCounter, 1)
defer mm_atomic.AddUint64(&mmGetDetailByID.afterGetDetailByIDCounter, 1)
mmGetDetailByID.t.Helper()
if mmGetDetailByID.inspectFuncGetDetailByID != nil {
mmGetDetailByID.inspectFuncGetDetailByID(ctx, id)
}
mm_params := RequestRepositoryMockGetDetailByIDParams{ctx, id}
// Record call args
mmGetDetailByID.GetDetailByIDMock.mutex.Lock()
mmGetDetailByID.GetDetailByIDMock.callArgs = append(mmGetDetailByID.GetDetailByIDMock.callArgs, &mm_params)
mmGetDetailByID.GetDetailByIDMock.mutex.Unlock()
for _, e := range mmGetDetailByID.GetDetailByIDMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.rp1, e.results.err
}
}
if mmGetDetailByID.GetDetailByIDMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmGetDetailByID.GetDetailByIDMock.defaultExpectation.Counter, 1)
mm_want := mmGetDetailByID.GetDetailByIDMock.defaultExpectation.params
mm_want_ptrs := mmGetDetailByID.GetDetailByIDMock.defaultExpectation.paramPtrs
mm_got := RequestRepositoryMockGetDetailByIDParams{ctx, id}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmGetDetailByID.t.Errorf("RequestRepositoryMock.GetDetailByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetDetailByID.GetDetailByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
mmGetDetailByID.t.Errorf("RequestRepositoryMock.GetDetailByID got unexpected parameter id, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetDetailByID.GetDetailByIDMock.defaultExpectation.expectationOrigins.originId, *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmGetDetailByID.t.Errorf("RequestRepositoryMock.GetDetailByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetDetailByID.GetDetailByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmGetDetailByID.GetDetailByIDMock.defaultExpectation.results
if mm_results == nil {
mmGetDetailByID.t.Fatal("No results are set for the RequestRepositoryMock.GetDetailByID")
}
return (*mm_results).rp1, (*mm_results).err
}
if mmGetDetailByID.funcGetDetailByID != nil {
return mmGetDetailByID.funcGetDetailByID(ctx, id)
}
mmGetDetailByID.t.Fatalf("Unexpected call to RequestRepositoryMock.GetDetailByID. %v %v", ctx, id)
return
}
// GetDetailByIDAfterCounter returns a count of finished RequestRepositoryMock.GetDetailByID invocations
func (mmGetDetailByID *RequestRepositoryMock) GetDetailByIDAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetDetailByID.afterGetDetailByIDCounter)
}
// GetDetailByIDBeforeCounter returns a count of RequestRepositoryMock.GetDetailByID invocations
func (mmGetDetailByID *RequestRepositoryMock) GetDetailByIDBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetDetailByID.beforeGetDetailByIDCounter)
}
// Calls returns a list of arguments used in each call to RequestRepositoryMock.GetDetailByID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmGetDetailByID *mRequestRepositoryMockGetDetailByID) Calls() []*RequestRepositoryMockGetDetailByIDParams {
mmGetDetailByID.mutex.RLock()
argCopy := make([]*RequestRepositoryMockGetDetailByIDParams, len(mmGetDetailByID.callArgs))
copy(argCopy, mmGetDetailByID.callArgs)
mmGetDetailByID.mutex.RUnlock()
return argCopy
}
// MinimockGetDetailByIDDone returns true if the count of the GetDetailByID invocations corresponds
// the number of defined expectations
func (m *RequestRepositoryMock) MinimockGetDetailByIDDone() bool {
if m.GetDetailByIDMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.GetDetailByIDMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.GetDetailByIDMock.invocationsDone()
}
// MinimockGetDetailByIDInspect logs each unmet expectation
func (m *RequestRepositoryMock) MinimockGetDetailByIDInspect() {
for _, e := range m.GetDetailByIDMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.GetDetailByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterGetDetailByIDCounter := mm_atomic.LoadUint64(&m.afterGetDetailByIDCounter)
// if default expectation was set then invocations count should be greater than zero
if m.GetDetailByIDMock.defaultExpectation != nil && afterGetDetailByIDCounter < 1 {
if m.GetDetailByIDMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestRepositoryMock.GetDetailByID at\n%s", m.GetDetailByIDMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestRepositoryMock.GetDetailByID at\n%s with params: %#v", m.GetDetailByIDMock.defaultExpectation.expectationOrigins.origin, *m.GetDetailByIDMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcGetDetailByID != nil && afterGetDetailByIDCounter < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.GetDetailByID at\n%s", m.funcGetDetailByIDOrigin)
}
if !m.GetDetailByIDMock.invocationsDone() && afterGetDetailByIDCounter > 0 {
m.t.Errorf("Expected %d calls to RequestRepositoryMock.GetDetailByID at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.GetDetailByIDMock.expectedInvocations), m.GetDetailByIDMock.expectedInvocationsOrigin, afterGetDetailByIDCounter)
}
}
type mRequestRepositoryMockGetUserStatistics struct {
optional bool
mock *RequestRepositoryMock
defaultExpectation *RequestRepositoryMockGetUserStatisticsExpectation
expectations []*RequestRepositoryMockGetUserStatisticsExpectation
callArgs []*RequestRepositoryMockGetUserStatisticsParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestRepositoryMockGetUserStatisticsExpectation specifies expectation struct of the RequestRepository.GetUserStatistics
type RequestRepositoryMockGetUserStatisticsExpectation struct {
mock *RequestRepositoryMock
params *RequestRepositoryMockGetUserStatisticsParams
paramPtrs *RequestRepositoryMockGetUserStatisticsParamPtrs
expectationOrigins RequestRepositoryMockGetUserStatisticsExpectationOrigins
results *RequestRepositoryMockGetUserStatisticsResults
returnOrigin string
Counter uint64
}
// RequestRepositoryMockGetUserStatisticsParams contains parameters of the RequestRepository.GetUserStatistics
type RequestRepositoryMockGetUserStatisticsParams struct {
ctx context.Context
userID int
}
// RequestRepositoryMockGetUserStatisticsParamPtrs contains pointers to parameters of the RequestRepository.GetUserStatistics
type RequestRepositoryMockGetUserStatisticsParamPtrs struct {
ctx *context.Context
userID *int
}
// RequestRepositoryMockGetUserStatisticsResults contains results of the RequestRepository.GetUserStatistics
type RequestRepositoryMockGetUserStatisticsResults struct {
requestsCount int
suppliersCount int
createdTZ int
err error
}
// RequestRepositoryMockGetUserStatisticsOrigins contains origins of expectations of the RequestRepository.GetUserStatistics
type RequestRepositoryMockGetUserStatisticsExpectationOrigins 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 (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) Optional() *mRequestRepositoryMockGetUserStatistics {
mmGetUserStatistics.optional = true
return mmGetUserStatistics
}
// Expect sets up expected params for RequestRepository.GetUserStatistics
func (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) Expect(ctx context.Context, userID int) *mRequestRepositoryMockGetUserStatistics {
if mmGetUserStatistics.mock.funcGetUserStatistics != nil {
mmGetUserStatistics.mock.t.Fatalf("RequestRepositoryMock.GetUserStatistics mock is already set by Set")
}
if mmGetUserStatistics.defaultExpectation == nil {
mmGetUserStatistics.defaultExpectation = &RequestRepositoryMockGetUserStatisticsExpectation{}
}
if mmGetUserStatistics.defaultExpectation.paramPtrs != nil {
mmGetUserStatistics.mock.t.Fatalf("RequestRepositoryMock.GetUserStatistics mock is already set by ExpectParams functions")
}
mmGetUserStatistics.defaultExpectation.params = &RequestRepositoryMockGetUserStatisticsParams{ctx, userID}
mmGetUserStatistics.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmGetUserStatistics.expectations {
if minimock.Equal(e.params, mmGetUserStatistics.defaultExpectation.params) {
mmGetUserStatistics.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetUserStatistics.defaultExpectation.params)
}
}
return mmGetUserStatistics
}
// ExpectCtxParam1 sets up expected param ctx for RequestRepository.GetUserStatistics
func (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) ExpectCtxParam1(ctx context.Context) *mRequestRepositoryMockGetUserStatistics {
if mmGetUserStatistics.mock.funcGetUserStatistics != nil {
mmGetUserStatistics.mock.t.Fatalf("RequestRepositoryMock.GetUserStatistics mock is already set by Set")
}
if mmGetUserStatistics.defaultExpectation == nil {
mmGetUserStatistics.defaultExpectation = &RequestRepositoryMockGetUserStatisticsExpectation{}
}
if mmGetUserStatistics.defaultExpectation.params != nil {
mmGetUserStatistics.mock.t.Fatalf("RequestRepositoryMock.GetUserStatistics mock is already set by Expect")
}
if mmGetUserStatistics.defaultExpectation.paramPtrs == nil {
mmGetUserStatistics.defaultExpectation.paramPtrs = &RequestRepositoryMockGetUserStatisticsParamPtrs{}
}
mmGetUserStatistics.defaultExpectation.paramPtrs.ctx = &ctx
mmGetUserStatistics.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmGetUserStatistics
}
// ExpectUserIDParam2 sets up expected param userID for RequestRepository.GetUserStatistics
func (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) ExpectUserIDParam2(userID int) *mRequestRepositoryMockGetUserStatistics {
if mmGetUserStatistics.mock.funcGetUserStatistics != nil {
mmGetUserStatistics.mock.t.Fatalf("RequestRepositoryMock.GetUserStatistics mock is already set by Set")
}
if mmGetUserStatistics.defaultExpectation == nil {
mmGetUserStatistics.defaultExpectation = &RequestRepositoryMockGetUserStatisticsExpectation{}
}
if mmGetUserStatistics.defaultExpectation.params != nil {
mmGetUserStatistics.mock.t.Fatalf("RequestRepositoryMock.GetUserStatistics mock is already set by Expect")
}
if mmGetUserStatistics.defaultExpectation.paramPtrs == nil {
mmGetUserStatistics.defaultExpectation.paramPtrs = &RequestRepositoryMockGetUserStatisticsParamPtrs{}
}
mmGetUserStatistics.defaultExpectation.paramPtrs.userID = &userID
mmGetUserStatistics.defaultExpectation.expectationOrigins.originUserID = minimock.CallerInfo(1)
return mmGetUserStatistics
}
// Inspect accepts an inspector function that has same arguments as the RequestRepository.GetUserStatistics
func (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) Inspect(f func(ctx context.Context, userID int)) *mRequestRepositoryMockGetUserStatistics {
if mmGetUserStatistics.mock.inspectFuncGetUserStatistics != nil {
mmGetUserStatistics.mock.t.Fatalf("Inspect function is already set for RequestRepositoryMock.GetUserStatistics")
}
mmGetUserStatistics.mock.inspectFuncGetUserStatistics = f
return mmGetUserStatistics
}
// Return sets up results that will be returned by RequestRepository.GetUserStatistics
func (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) Return(requestsCount int, suppliersCount int, createdTZ int, err error) *RequestRepositoryMock {
if mmGetUserStatistics.mock.funcGetUserStatistics != nil {
mmGetUserStatistics.mock.t.Fatalf("RequestRepositoryMock.GetUserStatistics mock is already set by Set")
}
if mmGetUserStatistics.defaultExpectation == nil {
mmGetUserStatistics.defaultExpectation = &RequestRepositoryMockGetUserStatisticsExpectation{mock: mmGetUserStatistics.mock}
}
mmGetUserStatistics.defaultExpectation.results = &RequestRepositoryMockGetUserStatisticsResults{requestsCount, suppliersCount, createdTZ, err}
mmGetUserStatistics.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmGetUserStatistics.mock
}
// Set uses given function f to mock the RequestRepository.GetUserStatistics method
func (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) Set(f func(ctx context.Context, userID int) (requestsCount int, suppliersCount int, createdTZ int, err error)) *RequestRepositoryMock {
if mmGetUserStatistics.defaultExpectation != nil {
mmGetUserStatistics.mock.t.Fatalf("Default expectation is already set for the RequestRepository.GetUserStatistics method")
}
if len(mmGetUserStatistics.expectations) > 0 {
mmGetUserStatistics.mock.t.Fatalf("Some expectations are already set for the RequestRepository.GetUserStatistics method")
}
mmGetUserStatistics.mock.funcGetUserStatistics = f
mmGetUserStatistics.mock.funcGetUserStatisticsOrigin = minimock.CallerInfo(1)
return mmGetUserStatistics.mock
}
// When sets expectation for the RequestRepository.GetUserStatistics which will trigger the result defined by the following
// Then helper
func (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) When(ctx context.Context, userID int) *RequestRepositoryMockGetUserStatisticsExpectation {
if mmGetUserStatistics.mock.funcGetUserStatistics != nil {
mmGetUserStatistics.mock.t.Fatalf("RequestRepositoryMock.GetUserStatistics mock is already set by Set")
}
expectation := &RequestRepositoryMockGetUserStatisticsExpectation{
mock: mmGetUserStatistics.mock,
params: &RequestRepositoryMockGetUserStatisticsParams{ctx, userID},
expectationOrigins: RequestRepositoryMockGetUserStatisticsExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmGetUserStatistics.expectations = append(mmGetUserStatistics.expectations, expectation)
return expectation
}
// Then sets up RequestRepository.GetUserStatistics return parameters for the expectation previously defined by the When method
func (e *RequestRepositoryMockGetUserStatisticsExpectation) Then(requestsCount int, suppliersCount int, createdTZ int, err error) *RequestRepositoryMock {
e.results = &RequestRepositoryMockGetUserStatisticsResults{requestsCount, suppliersCount, createdTZ, err}
return e.mock
}
// Times sets number of times RequestRepository.GetUserStatistics should be invoked
func (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) Times(n uint64) *mRequestRepositoryMockGetUserStatistics {
if n == 0 {
mmGetUserStatistics.mock.t.Fatalf("Times of RequestRepositoryMock.GetUserStatistics mock can not be zero")
}
mm_atomic.StoreUint64(&mmGetUserStatistics.expectedInvocations, n)
mmGetUserStatistics.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmGetUserStatistics
}
func (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) invocationsDone() bool {
if len(mmGetUserStatistics.expectations) == 0 && mmGetUserStatistics.defaultExpectation == nil && mmGetUserStatistics.mock.funcGetUserStatistics == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmGetUserStatistics.mock.afterGetUserStatisticsCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmGetUserStatistics.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// GetUserStatistics implements mm_repository.RequestRepository
func (mmGetUserStatistics *RequestRepositoryMock) GetUserStatistics(ctx context.Context, userID int) (requestsCount int, suppliersCount int, createdTZ int, err error) {
mm_atomic.AddUint64(&mmGetUserStatistics.beforeGetUserStatisticsCounter, 1)
defer mm_atomic.AddUint64(&mmGetUserStatistics.afterGetUserStatisticsCounter, 1)
mmGetUserStatistics.t.Helper()
if mmGetUserStatistics.inspectFuncGetUserStatistics != nil {
mmGetUserStatistics.inspectFuncGetUserStatistics(ctx, userID)
}
mm_params := RequestRepositoryMockGetUserStatisticsParams{ctx, userID}
// Record call args
mmGetUserStatistics.GetUserStatisticsMock.mutex.Lock()
mmGetUserStatistics.GetUserStatisticsMock.callArgs = append(mmGetUserStatistics.GetUserStatisticsMock.callArgs, &mm_params)
mmGetUserStatistics.GetUserStatisticsMock.mutex.Unlock()
for _, e := range mmGetUserStatistics.GetUserStatisticsMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.requestsCount, e.results.suppliersCount, e.results.createdTZ, e.results.err
}
}
if mmGetUserStatistics.GetUserStatisticsMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmGetUserStatistics.GetUserStatisticsMock.defaultExpectation.Counter, 1)
mm_want := mmGetUserStatistics.GetUserStatisticsMock.defaultExpectation.params
mm_want_ptrs := mmGetUserStatistics.GetUserStatisticsMock.defaultExpectation.paramPtrs
mm_got := RequestRepositoryMockGetUserStatisticsParams{ctx, userID}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmGetUserStatistics.t.Errorf("RequestRepositoryMock.GetUserStatistics got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetUserStatistics.GetUserStatisticsMock.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) {
mmGetUserStatistics.t.Errorf("RequestRepositoryMock.GetUserStatistics got unexpected parameter userID, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetUserStatistics.GetUserStatisticsMock.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) {
mmGetUserStatistics.t.Errorf("RequestRepositoryMock.GetUserStatistics got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmGetUserStatistics.GetUserStatisticsMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmGetUserStatistics.GetUserStatisticsMock.defaultExpectation.results
if mm_results == nil {
mmGetUserStatistics.t.Fatal("No results are set for the RequestRepositoryMock.GetUserStatistics")
}
return (*mm_results).requestsCount, (*mm_results).suppliersCount, (*mm_results).createdTZ, (*mm_results).err
}
if mmGetUserStatistics.funcGetUserStatistics != nil {
return mmGetUserStatistics.funcGetUserStatistics(ctx, userID)
}
mmGetUserStatistics.t.Fatalf("Unexpected call to RequestRepositoryMock.GetUserStatistics. %v %v", ctx, userID)
return
}
// GetUserStatisticsAfterCounter returns a count of finished RequestRepositoryMock.GetUserStatistics invocations
func (mmGetUserStatistics *RequestRepositoryMock) GetUserStatisticsAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetUserStatistics.afterGetUserStatisticsCounter)
}
// GetUserStatisticsBeforeCounter returns a count of RequestRepositoryMock.GetUserStatistics invocations
func (mmGetUserStatistics *RequestRepositoryMock) GetUserStatisticsBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmGetUserStatistics.beforeGetUserStatisticsCounter)
}
// Calls returns a list of arguments used in each call to RequestRepositoryMock.GetUserStatistics.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmGetUserStatistics *mRequestRepositoryMockGetUserStatistics) Calls() []*RequestRepositoryMockGetUserStatisticsParams {
mmGetUserStatistics.mutex.RLock()
argCopy := make([]*RequestRepositoryMockGetUserStatisticsParams, len(mmGetUserStatistics.callArgs))
copy(argCopy, mmGetUserStatistics.callArgs)
mmGetUserStatistics.mutex.RUnlock()
return argCopy
}
// MinimockGetUserStatisticsDone returns true if the count of the GetUserStatistics invocations corresponds
// the number of defined expectations
func (m *RequestRepositoryMock) MinimockGetUserStatisticsDone() bool {
if m.GetUserStatisticsMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.GetUserStatisticsMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.GetUserStatisticsMock.invocationsDone()
}
// MinimockGetUserStatisticsInspect logs each unmet expectation
func (m *RequestRepositoryMock) MinimockGetUserStatisticsInspect() {
for _, e := range m.GetUserStatisticsMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.GetUserStatistics at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterGetUserStatisticsCounter := mm_atomic.LoadUint64(&m.afterGetUserStatisticsCounter)
// if default expectation was set then invocations count should be greater than zero
if m.GetUserStatisticsMock.defaultExpectation != nil && afterGetUserStatisticsCounter < 1 {
if m.GetUserStatisticsMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestRepositoryMock.GetUserStatistics at\n%s", m.GetUserStatisticsMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestRepositoryMock.GetUserStatistics at\n%s with params: %#v", m.GetUserStatisticsMock.defaultExpectation.expectationOrigins.origin, *m.GetUserStatisticsMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcGetUserStatistics != nil && afterGetUserStatisticsCounter < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.GetUserStatistics at\n%s", m.funcGetUserStatisticsOrigin)
}
if !m.GetUserStatisticsMock.invocationsDone() && afterGetUserStatisticsCounter > 0 {
m.t.Errorf("Expected %d calls to RequestRepositoryMock.GetUserStatistics at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.GetUserStatisticsMock.expectedInvocations), m.GetUserStatisticsMock.expectedInvocationsOrigin, afterGetUserStatisticsCounter)
}
}
type mRequestRepositoryMockUpdateFinalTZ struct {
optional bool
mock *RequestRepositoryMock
defaultExpectation *RequestRepositoryMockUpdateFinalTZExpectation
expectations []*RequestRepositoryMockUpdateFinalTZExpectation
callArgs []*RequestRepositoryMockUpdateFinalTZParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestRepositoryMockUpdateFinalTZExpectation specifies expectation struct of the RequestRepository.UpdateFinalTZ
type RequestRepositoryMockUpdateFinalTZExpectation struct {
mock *RequestRepositoryMock
params *RequestRepositoryMockUpdateFinalTZParams
paramPtrs *RequestRepositoryMockUpdateFinalTZParamPtrs
expectationOrigins RequestRepositoryMockUpdateFinalTZExpectationOrigins
results *RequestRepositoryMockUpdateFinalTZResults
returnOrigin string
Counter uint64
}
// RequestRepositoryMockUpdateFinalTZParams contains parameters of the RequestRepository.UpdateFinalTZ
type RequestRepositoryMockUpdateFinalTZParams struct {
ctx context.Context
id uuid.UUID
finalTZ string
}
// RequestRepositoryMockUpdateFinalTZParamPtrs contains pointers to parameters of the RequestRepository.UpdateFinalTZ
type RequestRepositoryMockUpdateFinalTZParamPtrs struct {
ctx *context.Context
id *uuid.UUID
finalTZ *string
}
// RequestRepositoryMockUpdateFinalTZResults contains results of the RequestRepository.UpdateFinalTZ
type RequestRepositoryMockUpdateFinalTZResults struct {
err error
}
// RequestRepositoryMockUpdateFinalTZOrigins contains origins of expectations of the RequestRepository.UpdateFinalTZ
type RequestRepositoryMockUpdateFinalTZExpectationOrigins struct {
origin string
originCtx string
originId string
originFinalTZ 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 (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) Optional() *mRequestRepositoryMockUpdateFinalTZ {
mmUpdateFinalTZ.optional = true
return mmUpdateFinalTZ
}
// Expect sets up expected params for RequestRepository.UpdateFinalTZ
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) Expect(ctx context.Context, id uuid.UUID, finalTZ string) *mRequestRepositoryMockUpdateFinalTZ {
if mmUpdateFinalTZ.mock.funcUpdateFinalTZ != nil {
mmUpdateFinalTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateFinalTZ mock is already set by Set")
}
if mmUpdateFinalTZ.defaultExpectation == nil {
mmUpdateFinalTZ.defaultExpectation = &RequestRepositoryMockUpdateFinalTZExpectation{}
}
if mmUpdateFinalTZ.defaultExpectation.paramPtrs != nil {
mmUpdateFinalTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateFinalTZ mock is already set by ExpectParams functions")
}
mmUpdateFinalTZ.defaultExpectation.params = &RequestRepositoryMockUpdateFinalTZParams{ctx, id, finalTZ}
mmUpdateFinalTZ.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmUpdateFinalTZ.expectations {
if minimock.Equal(e.params, mmUpdateFinalTZ.defaultExpectation.params) {
mmUpdateFinalTZ.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdateFinalTZ.defaultExpectation.params)
}
}
return mmUpdateFinalTZ
}
// ExpectCtxParam1 sets up expected param ctx for RequestRepository.UpdateFinalTZ
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) ExpectCtxParam1(ctx context.Context) *mRequestRepositoryMockUpdateFinalTZ {
if mmUpdateFinalTZ.mock.funcUpdateFinalTZ != nil {
mmUpdateFinalTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateFinalTZ mock is already set by Set")
}
if mmUpdateFinalTZ.defaultExpectation == nil {
mmUpdateFinalTZ.defaultExpectation = &RequestRepositoryMockUpdateFinalTZExpectation{}
}
if mmUpdateFinalTZ.defaultExpectation.params != nil {
mmUpdateFinalTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateFinalTZ mock is already set by Expect")
}
if mmUpdateFinalTZ.defaultExpectation.paramPtrs == nil {
mmUpdateFinalTZ.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateFinalTZParamPtrs{}
}
mmUpdateFinalTZ.defaultExpectation.paramPtrs.ctx = &ctx
mmUpdateFinalTZ.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmUpdateFinalTZ
}
// ExpectIdParam2 sets up expected param id for RequestRepository.UpdateFinalTZ
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) ExpectIdParam2(id uuid.UUID) *mRequestRepositoryMockUpdateFinalTZ {
if mmUpdateFinalTZ.mock.funcUpdateFinalTZ != nil {
mmUpdateFinalTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateFinalTZ mock is already set by Set")
}
if mmUpdateFinalTZ.defaultExpectation == nil {
mmUpdateFinalTZ.defaultExpectation = &RequestRepositoryMockUpdateFinalTZExpectation{}
}
if mmUpdateFinalTZ.defaultExpectation.params != nil {
mmUpdateFinalTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateFinalTZ mock is already set by Expect")
}
if mmUpdateFinalTZ.defaultExpectation.paramPtrs == nil {
mmUpdateFinalTZ.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateFinalTZParamPtrs{}
}
mmUpdateFinalTZ.defaultExpectation.paramPtrs.id = &id
mmUpdateFinalTZ.defaultExpectation.expectationOrigins.originId = minimock.CallerInfo(1)
return mmUpdateFinalTZ
}
// ExpectFinalTZParam3 sets up expected param finalTZ for RequestRepository.UpdateFinalTZ
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) ExpectFinalTZParam3(finalTZ string) *mRequestRepositoryMockUpdateFinalTZ {
if mmUpdateFinalTZ.mock.funcUpdateFinalTZ != nil {
mmUpdateFinalTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateFinalTZ mock is already set by Set")
}
if mmUpdateFinalTZ.defaultExpectation == nil {
mmUpdateFinalTZ.defaultExpectation = &RequestRepositoryMockUpdateFinalTZExpectation{}
}
if mmUpdateFinalTZ.defaultExpectation.params != nil {
mmUpdateFinalTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateFinalTZ mock is already set by Expect")
}
if mmUpdateFinalTZ.defaultExpectation.paramPtrs == nil {
mmUpdateFinalTZ.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateFinalTZParamPtrs{}
}
mmUpdateFinalTZ.defaultExpectation.paramPtrs.finalTZ = &finalTZ
mmUpdateFinalTZ.defaultExpectation.expectationOrigins.originFinalTZ = minimock.CallerInfo(1)
return mmUpdateFinalTZ
}
// Inspect accepts an inspector function that has same arguments as the RequestRepository.UpdateFinalTZ
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) Inspect(f func(ctx context.Context, id uuid.UUID, finalTZ string)) *mRequestRepositoryMockUpdateFinalTZ {
if mmUpdateFinalTZ.mock.inspectFuncUpdateFinalTZ != nil {
mmUpdateFinalTZ.mock.t.Fatalf("Inspect function is already set for RequestRepositoryMock.UpdateFinalTZ")
}
mmUpdateFinalTZ.mock.inspectFuncUpdateFinalTZ = f
return mmUpdateFinalTZ
}
// Return sets up results that will be returned by RequestRepository.UpdateFinalTZ
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) Return(err error) *RequestRepositoryMock {
if mmUpdateFinalTZ.mock.funcUpdateFinalTZ != nil {
mmUpdateFinalTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateFinalTZ mock is already set by Set")
}
if mmUpdateFinalTZ.defaultExpectation == nil {
mmUpdateFinalTZ.defaultExpectation = &RequestRepositoryMockUpdateFinalTZExpectation{mock: mmUpdateFinalTZ.mock}
}
mmUpdateFinalTZ.defaultExpectation.results = &RequestRepositoryMockUpdateFinalTZResults{err}
mmUpdateFinalTZ.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmUpdateFinalTZ.mock
}
// Set uses given function f to mock the RequestRepository.UpdateFinalTZ method
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) Set(f func(ctx context.Context, id uuid.UUID, finalTZ string) (err error)) *RequestRepositoryMock {
if mmUpdateFinalTZ.defaultExpectation != nil {
mmUpdateFinalTZ.mock.t.Fatalf("Default expectation is already set for the RequestRepository.UpdateFinalTZ method")
}
if len(mmUpdateFinalTZ.expectations) > 0 {
mmUpdateFinalTZ.mock.t.Fatalf("Some expectations are already set for the RequestRepository.UpdateFinalTZ method")
}
mmUpdateFinalTZ.mock.funcUpdateFinalTZ = f
mmUpdateFinalTZ.mock.funcUpdateFinalTZOrigin = minimock.CallerInfo(1)
return mmUpdateFinalTZ.mock
}
// When sets expectation for the RequestRepository.UpdateFinalTZ which will trigger the result defined by the following
// Then helper
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) When(ctx context.Context, id uuid.UUID, finalTZ string) *RequestRepositoryMockUpdateFinalTZExpectation {
if mmUpdateFinalTZ.mock.funcUpdateFinalTZ != nil {
mmUpdateFinalTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateFinalTZ mock is already set by Set")
}
expectation := &RequestRepositoryMockUpdateFinalTZExpectation{
mock: mmUpdateFinalTZ.mock,
params: &RequestRepositoryMockUpdateFinalTZParams{ctx, id, finalTZ},
expectationOrigins: RequestRepositoryMockUpdateFinalTZExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmUpdateFinalTZ.expectations = append(mmUpdateFinalTZ.expectations, expectation)
return expectation
}
// Then sets up RequestRepository.UpdateFinalTZ return parameters for the expectation previously defined by the When method
func (e *RequestRepositoryMockUpdateFinalTZExpectation) Then(err error) *RequestRepositoryMock {
e.results = &RequestRepositoryMockUpdateFinalTZResults{err}
return e.mock
}
// Times sets number of times RequestRepository.UpdateFinalTZ should be invoked
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) Times(n uint64) *mRequestRepositoryMockUpdateFinalTZ {
if n == 0 {
mmUpdateFinalTZ.mock.t.Fatalf("Times of RequestRepositoryMock.UpdateFinalTZ mock can not be zero")
}
mm_atomic.StoreUint64(&mmUpdateFinalTZ.expectedInvocations, n)
mmUpdateFinalTZ.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmUpdateFinalTZ
}
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) invocationsDone() bool {
if len(mmUpdateFinalTZ.expectations) == 0 && mmUpdateFinalTZ.defaultExpectation == nil && mmUpdateFinalTZ.mock.funcUpdateFinalTZ == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmUpdateFinalTZ.mock.afterUpdateFinalTZCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmUpdateFinalTZ.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// UpdateFinalTZ implements mm_repository.RequestRepository
func (mmUpdateFinalTZ *RequestRepositoryMock) UpdateFinalTZ(ctx context.Context, id uuid.UUID, finalTZ string) (err error) {
mm_atomic.AddUint64(&mmUpdateFinalTZ.beforeUpdateFinalTZCounter, 1)
defer mm_atomic.AddUint64(&mmUpdateFinalTZ.afterUpdateFinalTZCounter, 1)
mmUpdateFinalTZ.t.Helper()
if mmUpdateFinalTZ.inspectFuncUpdateFinalTZ != nil {
mmUpdateFinalTZ.inspectFuncUpdateFinalTZ(ctx, id, finalTZ)
}
mm_params := RequestRepositoryMockUpdateFinalTZParams{ctx, id, finalTZ}
// Record call args
mmUpdateFinalTZ.UpdateFinalTZMock.mutex.Lock()
mmUpdateFinalTZ.UpdateFinalTZMock.callArgs = append(mmUpdateFinalTZ.UpdateFinalTZMock.callArgs, &mm_params)
mmUpdateFinalTZ.UpdateFinalTZMock.mutex.Unlock()
for _, e := range mmUpdateFinalTZ.UpdateFinalTZMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.err
}
}
if mmUpdateFinalTZ.UpdateFinalTZMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmUpdateFinalTZ.UpdateFinalTZMock.defaultExpectation.Counter, 1)
mm_want := mmUpdateFinalTZ.UpdateFinalTZMock.defaultExpectation.params
mm_want_ptrs := mmUpdateFinalTZ.UpdateFinalTZMock.defaultExpectation.paramPtrs
mm_got := RequestRepositoryMockUpdateFinalTZParams{ctx, id, finalTZ}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmUpdateFinalTZ.t.Errorf("RequestRepositoryMock.UpdateFinalTZ got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateFinalTZ.UpdateFinalTZMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
mmUpdateFinalTZ.t.Errorf("RequestRepositoryMock.UpdateFinalTZ got unexpected parameter id, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateFinalTZ.UpdateFinalTZMock.defaultExpectation.expectationOrigins.originId, *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
}
if mm_want_ptrs.finalTZ != nil && !minimock.Equal(*mm_want_ptrs.finalTZ, mm_got.finalTZ) {
mmUpdateFinalTZ.t.Errorf("RequestRepositoryMock.UpdateFinalTZ got unexpected parameter finalTZ, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateFinalTZ.UpdateFinalTZMock.defaultExpectation.expectationOrigins.originFinalTZ, *mm_want_ptrs.finalTZ, mm_got.finalTZ, minimock.Diff(*mm_want_ptrs.finalTZ, mm_got.finalTZ))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmUpdateFinalTZ.t.Errorf("RequestRepositoryMock.UpdateFinalTZ got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateFinalTZ.UpdateFinalTZMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmUpdateFinalTZ.UpdateFinalTZMock.defaultExpectation.results
if mm_results == nil {
mmUpdateFinalTZ.t.Fatal("No results are set for the RequestRepositoryMock.UpdateFinalTZ")
}
return (*mm_results).err
}
if mmUpdateFinalTZ.funcUpdateFinalTZ != nil {
return mmUpdateFinalTZ.funcUpdateFinalTZ(ctx, id, finalTZ)
}
mmUpdateFinalTZ.t.Fatalf("Unexpected call to RequestRepositoryMock.UpdateFinalTZ. %v %v %v", ctx, id, finalTZ)
return
}
// UpdateFinalTZAfterCounter returns a count of finished RequestRepositoryMock.UpdateFinalTZ invocations
func (mmUpdateFinalTZ *RequestRepositoryMock) UpdateFinalTZAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmUpdateFinalTZ.afterUpdateFinalTZCounter)
}
// UpdateFinalTZBeforeCounter returns a count of RequestRepositoryMock.UpdateFinalTZ invocations
func (mmUpdateFinalTZ *RequestRepositoryMock) UpdateFinalTZBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmUpdateFinalTZ.beforeUpdateFinalTZCounter)
}
// Calls returns a list of arguments used in each call to RequestRepositoryMock.UpdateFinalTZ.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmUpdateFinalTZ *mRequestRepositoryMockUpdateFinalTZ) Calls() []*RequestRepositoryMockUpdateFinalTZParams {
mmUpdateFinalTZ.mutex.RLock()
argCopy := make([]*RequestRepositoryMockUpdateFinalTZParams, len(mmUpdateFinalTZ.callArgs))
copy(argCopy, mmUpdateFinalTZ.callArgs)
mmUpdateFinalTZ.mutex.RUnlock()
return argCopy
}
// MinimockUpdateFinalTZDone returns true if the count of the UpdateFinalTZ invocations corresponds
// the number of defined expectations
func (m *RequestRepositoryMock) MinimockUpdateFinalTZDone() bool {
if m.UpdateFinalTZMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.UpdateFinalTZMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.UpdateFinalTZMock.invocationsDone()
}
// MinimockUpdateFinalTZInspect logs each unmet expectation
func (m *RequestRepositoryMock) MinimockUpdateFinalTZInspect() {
for _, e := range m.UpdateFinalTZMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateFinalTZ at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterUpdateFinalTZCounter := mm_atomic.LoadUint64(&m.afterUpdateFinalTZCounter)
// if default expectation was set then invocations count should be greater than zero
if m.UpdateFinalTZMock.defaultExpectation != nil && afterUpdateFinalTZCounter < 1 {
if m.UpdateFinalTZMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateFinalTZ at\n%s", m.UpdateFinalTZMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateFinalTZ at\n%s with params: %#v", m.UpdateFinalTZMock.defaultExpectation.expectationOrigins.origin, *m.UpdateFinalTZMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcUpdateFinalTZ != nil && afterUpdateFinalTZCounter < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateFinalTZ at\n%s", m.funcUpdateFinalTZOrigin)
}
if !m.UpdateFinalTZMock.invocationsDone() && afterUpdateFinalTZCounter > 0 {
m.t.Errorf("Expected %d calls to RequestRepositoryMock.UpdateFinalTZ at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.UpdateFinalTZMock.expectedInvocations), m.UpdateFinalTZMock.expectedInvocationsOrigin, afterUpdateFinalTZCounter)
}
}
type mRequestRepositoryMockUpdateWithTZ struct {
optional bool
mock *RequestRepositoryMock
defaultExpectation *RequestRepositoryMockUpdateWithTZExpectation
expectations []*RequestRepositoryMockUpdateWithTZExpectation
callArgs []*RequestRepositoryMockUpdateWithTZParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestRepositoryMockUpdateWithTZExpectation specifies expectation struct of the RequestRepository.UpdateWithTZ
type RequestRepositoryMockUpdateWithTZExpectation struct {
mock *RequestRepositoryMock
params *RequestRepositoryMockUpdateWithTZParams
paramPtrs *RequestRepositoryMockUpdateWithTZParamPtrs
expectationOrigins RequestRepositoryMockUpdateWithTZExpectationOrigins
results *RequestRepositoryMockUpdateWithTZResults
returnOrigin string
Counter uint64
}
// RequestRepositoryMockUpdateWithTZParams contains parameters of the RequestRepository.UpdateWithTZ
type RequestRepositoryMockUpdateWithTZParams struct {
ctx context.Context
id uuid.UUID
tz string
generated bool
}
// RequestRepositoryMockUpdateWithTZParamPtrs contains pointers to parameters of the RequestRepository.UpdateWithTZ
type RequestRepositoryMockUpdateWithTZParamPtrs struct {
ctx *context.Context
id *uuid.UUID
tz *string
generated *bool
}
// RequestRepositoryMockUpdateWithTZResults contains results of the RequestRepository.UpdateWithTZ
type RequestRepositoryMockUpdateWithTZResults struct {
err error
}
// RequestRepositoryMockUpdateWithTZOrigins contains origins of expectations of the RequestRepository.UpdateWithTZ
type RequestRepositoryMockUpdateWithTZExpectationOrigins struct {
origin string
originCtx string
originId string
originTz string
originGenerated 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 (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) Optional() *mRequestRepositoryMockUpdateWithTZ {
mmUpdateWithTZ.optional = true
return mmUpdateWithTZ
}
// Expect sets up expected params for RequestRepository.UpdateWithTZ
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) Expect(ctx context.Context, id uuid.UUID, tz string, generated bool) *mRequestRepositoryMockUpdateWithTZ {
if mmUpdateWithTZ.mock.funcUpdateWithTZ != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Set")
}
if mmUpdateWithTZ.defaultExpectation == nil {
mmUpdateWithTZ.defaultExpectation = &RequestRepositoryMockUpdateWithTZExpectation{}
}
if mmUpdateWithTZ.defaultExpectation.paramPtrs != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by ExpectParams functions")
}
mmUpdateWithTZ.defaultExpectation.params = &RequestRepositoryMockUpdateWithTZParams{ctx, id, tz, generated}
mmUpdateWithTZ.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmUpdateWithTZ.expectations {
if minimock.Equal(e.params, mmUpdateWithTZ.defaultExpectation.params) {
mmUpdateWithTZ.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdateWithTZ.defaultExpectation.params)
}
}
return mmUpdateWithTZ
}
// ExpectCtxParam1 sets up expected param ctx for RequestRepository.UpdateWithTZ
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) ExpectCtxParam1(ctx context.Context) *mRequestRepositoryMockUpdateWithTZ {
if mmUpdateWithTZ.mock.funcUpdateWithTZ != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Set")
}
if mmUpdateWithTZ.defaultExpectation == nil {
mmUpdateWithTZ.defaultExpectation = &RequestRepositoryMockUpdateWithTZExpectation{}
}
if mmUpdateWithTZ.defaultExpectation.params != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Expect")
}
if mmUpdateWithTZ.defaultExpectation.paramPtrs == nil {
mmUpdateWithTZ.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateWithTZParamPtrs{}
}
mmUpdateWithTZ.defaultExpectation.paramPtrs.ctx = &ctx
mmUpdateWithTZ.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmUpdateWithTZ
}
// ExpectIdParam2 sets up expected param id for RequestRepository.UpdateWithTZ
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) ExpectIdParam2(id uuid.UUID) *mRequestRepositoryMockUpdateWithTZ {
if mmUpdateWithTZ.mock.funcUpdateWithTZ != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Set")
}
if mmUpdateWithTZ.defaultExpectation == nil {
mmUpdateWithTZ.defaultExpectation = &RequestRepositoryMockUpdateWithTZExpectation{}
}
if mmUpdateWithTZ.defaultExpectation.params != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Expect")
}
if mmUpdateWithTZ.defaultExpectation.paramPtrs == nil {
mmUpdateWithTZ.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateWithTZParamPtrs{}
}
mmUpdateWithTZ.defaultExpectation.paramPtrs.id = &id
mmUpdateWithTZ.defaultExpectation.expectationOrigins.originId = minimock.CallerInfo(1)
return mmUpdateWithTZ
}
// ExpectTzParam3 sets up expected param tz for RequestRepository.UpdateWithTZ
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) ExpectTzParam3(tz string) *mRequestRepositoryMockUpdateWithTZ {
if mmUpdateWithTZ.mock.funcUpdateWithTZ != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Set")
}
if mmUpdateWithTZ.defaultExpectation == nil {
mmUpdateWithTZ.defaultExpectation = &RequestRepositoryMockUpdateWithTZExpectation{}
}
if mmUpdateWithTZ.defaultExpectation.params != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Expect")
}
if mmUpdateWithTZ.defaultExpectation.paramPtrs == nil {
mmUpdateWithTZ.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateWithTZParamPtrs{}
}
mmUpdateWithTZ.defaultExpectation.paramPtrs.tz = &tz
mmUpdateWithTZ.defaultExpectation.expectationOrigins.originTz = minimock.CallerInfo(1)
return mmUpdateWithTZ
}
// ExpectGeneratedParam4 sets up expected param generated for RequestRepository.UpdateWithTZ
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) ExpectGeneratedParam4(generated bool) *mRequestRepositoryMockUpdateWithTZ {
if mmUpdateWithTZ.mock.funcUpdateWithTZ != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Set")
}
if mmUpdateWithTZ.defaultExpectation == nil {
mmUpdateWithTZ.defaultExpectation = &RequestRepositoryMockUpdateWithTZExpectation{}
}
if mmUpdateWithTZ.defaultExpectation.params != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Expect")
}
if mmUpdateWithTZ.defaultExpectation.paramPtrs == nil {
mmUpdateWithTZ.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateWithTZParamPtrs{}
}
mmUpdateWithTZ.defaultExpectation.paramPtrs.generated = &generated
mmUpdateWithTZ.defaultExpectation.expectationOrigins.originGenerated = minimock.CallerInfo(1)
return mmUpdateWithTZ
}
// Inspect accepts an inspector function that has same arguments as the RequestRepository.UpdateWithTZ
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) Inspect(f func(ctx context.Context, id uuid.UUID, tz string, generated bool)) *mRequestRepositoryMockUpdateWithTZ {
if mmUpdateWithTZ.mock.inspectFuncUpdateWithTZ != nil {
mmUpdateWithTZ.mock.t.Fatalf("Inspect function is already set for RequestRepositoryMock.UpdateWithTZ")
}
mmUpdateWithTZ.mock.inspectFuncUpdateWithTZ = f
return mmUpdateWithTZ
}
// Return sets up results that will be returned by RequestRepository.UpdateWithTZ
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) Return(err error) *RequestRepositoryMock {
if mmUpdateWithTZ.mock.funcUpdateWithTZ != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Set")
}
if mmUpdateWithTZ.defaultExpectation == nil {
mmUpdateWithTZ.defaultExpectation = &RequestRepositoryMockUpdateWithTZExpectation{mock: mmUpdateWithTZ.mock}
}
mmUpdateWithTZ.defaultExpectation.results = &RequestRepositoryMockUpdateWithTZResults{err}
mmUpdateWithTZ.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmUpdateWithTZ.mock
}
// Set uses given function f to mock the RequestRepository.UpdateWithTZ method
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) Set(f func(ctx context.Context, id uuid.UUID, tz string, generated bool) (err error)) *RequestRepositoryMock {
if mmUpdateWithTZ.defaultExpectation != nil {
mmUpdateWithTZ.mock.t.Fatalf("Default expectation is already set for the RequestRepository.UpdateWithTZ method")
}
if len(mmUpdateWithTZ.expectations) > 0 {
mmUpdateWithTZ.mock.t.Fatalf("Some expectations are already set for the RequestRepository.UpdateWithTZ method")
}
mmUpdateWithTZ.mock.funcUpdateWithTZ = f
mmUpdateWithTZ.mock.funcUpdateWithTZOrigin = minimock.CallerInfo(1)
return mmUpdateWithTZ.mock
}
// When sets expectation for the RequestRepository.UpdateWithTZ which will trigger the result defined by the following
// Then helper
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) When(ctx context.Context, id uuid.UUID, tz string, generated bool) *RequestRepositoryMockUpdateWithTZExpectation {
if mmUpdateWithTZ.mock.funcUpdateWithTZ != nil {
mmUpdateWithTZ.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZ mock is already set by Set")
}
expectation := &RequestRepositoryMockUpdateWithTZExpectation{
mock: mmUpdateWithTZ.mock,
params: &RequestRepositoryMockUpdateWithTZParams{ctx, id, tz, generated},
expectationOrigins: RequestRepositoryMockUpdateWithTZExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmUpdateWithTZ.expectations = append(mmUpdateWithTZ.expectations, expectation)
return expectation
}
// Then sets up RequestRepository.UpdateWithTZ return parameters for the expectation previously defined by the When method
func (e *RequestRepositoryMockUpdateWithTZExpectation) Then(err error) *RequestRepositoryMock {
e.results = &RequestRepositoryMockUpdateWithTZResults{err}
return e.mock
}
// Times sets number of times RequestRepository.UpdateWithTZ should be invoked
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) Times(n uint64) *mRequestRepositoryMockUpdateWithTZ {
if n == 0 {
mmUpdateWithTZ.mock.t.Fatalf("Times of RequestRepositoryMock.UpdateWithTZ mock can not be zero")
}
mm_atomic.StoreUint64(&mmUpdateWithTZ.expectedInvocations, n)
mmUpdateWithTZ.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmUpdateWithTZ
}
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) invocationsDone() bool {
if len(mmUpdateWithTZ.expectations) == 0 && mmUpdateWithTZ.defaultExpectation == nil && mmUpdateWithTZ.mock.funcUpdateWithTZ == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmUpdateWithTZ.mock.afterUpdateWithTZCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmUpdateWithTZ.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// UpdateWithTZ implements mm_repository.RequestRepository
func (mmUpdateWithTZ *RequestRepositoryMock) UpdateWithTZ(ctx context.Context, id uuid.UUID, tz string, generated bool) (err error) {
mm_atomic.AddUint64(&mmUpdateWithTZ.beforeUpdateWithTZCounter, 1)
defer mm_atomic.AddUint64(&mmUpdateWithTZ.afterUpdateWithTZCounter, 1)
mmUpdateWithTZ.t.Helper()
if mmUpdateWithTZ.inspectFuncUpdateWithTZ != nil {
mmUpdateWithTZ.inspectFuncUpdateWithTZ(ctx, id, tz, generated)
}
mm_params := RequestRepositoryMockUpdateWithTZParams{ctx, id, tz, generated}
// Record call args
mmUpdateWithTZ.UpdateWithTZMock.mutex.Lock()
mmUpdateWithTZ.UpdateWithTZMock.callArgs = append(mmUpdateWithTZ.UpdateWithTZMock.callArgs, &mm_params)
mmUpdateWithTZ.UpdateWithTZMock.mutex.Unlock()
for _, e := range mmUpdateWithTZ.UpdateWithTZMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.err
}
}
if mmUpdateWithTZ.UpdateWithTZMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmUpdateWithTZ.UpdateWithTZMock.defaultExpectation.Counter, 1)
mm_want := mmUpdateWithTZ.UpdateWithTZMock.defaultExpectation.params
mm_want_ptrs := mmUpdateWithTZ.UpdateWithTZMock.defaultExpectation.paramPtrs
mm_got := RequestRepositoryMockUpdateWithTZParams{ctx, id, tz, generated}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmUpdateWithTZ.t.Errorf("RequestRepositoryMock.UpdateWithTZ got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZ.UpdateWithTZMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
mmUpdateWithTZ.t.Errorf("RequestRepositoryMock.UpdateWithTZ got unexpected parameter id, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZ.UpdateWithTZMock.defaultExpectation.expectationOrigins.originId, *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
}
if mm_want_ptrs.tz != nil && !minimock.Equal(*mm_want_ptrs.tz, mm_got.tz) {
mmUpdateWithTZ.t.Errorf("RequestRepositoryMock.UpdateWithTZ got unexpected parameter tz, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZ.UpdateWithTZMock.defaultExpectation.expectationOrigins.originTz, *mm_want_ptrs.tz, mm_got.tz, minimock.Diff(*mm_want_ptrs.tz, mm_got.tz))
}
if mm_want_ptrs.generated != nil && !minimock.Equal(*mm_want_ptrs.generated, mm_got.generated) {
mmUpdateWithTZ.t.Errorf("RequestRepositoryMock.UpdateWithTZ got unexpected parameter generated, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZ.UpdateWithTZMock.defaultExpectation.expectationOrigins.originGenerated, *mm_want_ptrs.generated, mm_got.generated, minimock.Diff(*mm_want_ptrs.generated, mm_got.generated))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmUpdateWithTZ.t.Errorf("RequestRepositoryMock.UpdateWithTZ got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZ.UpdateWithTZMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmUpdateWithTZ.UpdateWithTZMock.defaultExpectation.results
if mm_results == nil {
mmUpdateWithTZ.t.Fatal("No results are set for the RequestRepositoryMock.UpdateWithTZ")
}
return (*mm_results).err
}
if mmUpdateWithTZ.funcUpdateWithTZ != nil {
return mmUpdateWithTZ.funcUpdateWithTZ(ctx, id, tz, generated)
}
mmUpdateWithTZ.t.Fatalf("Unexpected call to RequestRepositoryMock.UpdateWithTZ. %v %v %v %v", ctx, id, tz, generated)
return
}
// UpdateWithTZAfterCounter returns a count of finished RequestRepositoryMock.UpdateWithTZ invocations
func (mmUpdateWithTZ *RequestRepositoryMock) UpdateWithTZAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmUpdateWithTZ.afterUpdateWithTZCounter)
}
// UpdateWithTZBeforeCounter returns a count of RequestRepositoryMock.UpdateWithTZ invocations
func (mmUpdateWithTZ *RequestRepositoryMock) UpdateWithTZBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmUpdateWithTZ.beforeUpdateWithTZCounter)
}
// Calls returns a list of arguments used in each call to RequestRepositoryMock.UpdateWithTZ.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmUpdateWithTZ *mRequestRepositoryMockUpdateWithTZ) Calls() []*RequestRepositoryMockUpdateWithTZParams {
mmUpdateWithTZ.mutex.RLock()
argCopy := make([]*RequestRepositoryMockUpdateWithTZParams, len(mmUpdateWithTZ.callArgs))
copy(argCopy, mmUpdateWithTZ.callArgs)
mmUpdateWithTZ.mutex.RUnlock()
return argCopy
}
// MinimockUpdateWithTZDone returns true if the count of the UpdateWithTZ invocations corresponds
// the number of defined expectations
func (m *RequestRepositoryMock) MinimockUpdateWithTZDone() bool {
if m.UpdateWithTZMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.UpdateWithTZMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.UpdateWithTZMock.invocationsDone()
}
// MinimockUpdateWithTZInspect logs each unmet expectation
func (m *RequestRepositoryMock) MinimockUpdateWithTZInspect() {
for _, e := range m.UpdateWithTZMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateWithTZ at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterUpdateWithTZCounter := mm_atomic.LoadUint64(&m.afterUpdateWithTZCounter)
// if default expectation was set then invocations count should be greater than zero
if m.UpdateWithTZMock.defaultExpectation != nil && afterUpdateWithTZCounter < 1 {
if m.UpdateWithTZMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateWithTZ at\n%s", m.UpdateWithTZMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateWithTZ at\n%s with params: %#v", m.UpdateWithTZMock.defaultExpectation.expectationOrigins.origin, *m.UpdateWithTZMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcUpdateWithTZ != nil && afterUpdateWithTZCounter < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateWithTZ at\n%s", m.funcUpdateWithTZOrigin)
}
if !m.UpdateWithTZMock.invocationsDone() && afterUpdateWithTZCounter > 0 {
m.t.Errorf("Expected %d calls to RequestRepositoryMock.UpdateWithTZ at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.UpdateWithTZMock.expectedInvocations), m.UpdateWithTZMock.expectedInvocationsOrigin, afterUpdateWithTZCounter)
}
}
type mRequestRepositoryMockUpdateWithTZTx struct {
optional bool
mock *RequestRepositoryMock
defaultExpectation *RequestRepositoryMockUpdateWithTZTxExpectation
expectations []*RequestRepositoryMockUpdateWithTZTxExpectation
callArgs []*RequestRepositoryMockUpdateWithTZTxParams
mutex sync.RWMutex
expectedInvocations uint64
expectedInvocationsOrigin string
}
// RequestRepositoryMockUpdateWithTZTxExpectation specifies expectation struct of the RequestRepository.UpdateWithTZTx
type RequestRepositoryMockUpdateWithTZTxExpectation struct {
mock *RequestRepositoryMock
params *RequestRepositoryMockUpdateWithTZTxParams
paramPtrs *RequestRepositoryMockUpdateWithTZTxParamPtrs
expectationOrigins RequestRepositoryMockUpdateWithTZTxExpectationOrigins
results *RequestRepositoryMockUpdateWithTZTxResults
returnOrigin string
Counter uint64
}
// RequestRepositoryMockUpdateWithTZTxParams contains parameters of the RequestRepository.UpdateWithTZTx
type RequestRepositoryMockUpdateWithTZTxParams struct {
ctx context.Context
tx pgx.Tx
id uuid.UUID
tz string
generated bool
}
// RequestRepositoryMockUpdateWithTZTxParamPtrs contains pointers to parameters of the RequestRepository.UpdateWithTZTx
type RequestRepositoryMockUpdateWithTZTxParamPtrs struct {
ctx *context.Context
tx *pgx.Tx
id *uuid.UUID
tz *string
generated *bool
}
// RequestRepositoryMockUpdateWithTZTxResults contains results of the RequestRepository.UpdateWithTZTx
type RequestRepositoryMockUpdateWithTZTxResults struct {
err error
}
// RequestRepositoryMockUpdateWithTZTxOrigins contains origins of expectations of the RequestRepository.UpdateWithTZTx
type RequestRepositoryMockUpdateWithTZTxExpectationOrigins struct {
origin string
originCtx string
originTx string
originId string
originTz string
originGenerated 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 (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) Optional() *mRequestRepositoryMockUpdateWithTZTx {
mmUpdateWithTZTx.optional = true
return mmUpdateWithTZTx
}
// Expect sets up expected params for RequestRepository.UpdateWithTZTx
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) Expect(ctx context.Context, tx pgx.Tx, id uuid.UUID, tz string, generated bool) *mRequestRepositoryMockUpdateWithTZTx {
if mmUpdateWithTZTx.mock.funcUpdateWithTZTx != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Set")
}
if mmUpdateWithTZTx.defaultExpectation == nil {
mmUpdateWithTZTx.defaultExpectation = &RequestRepositoryMockUpdateWithTZTxExpectation{}
}
if mmUpdateWithTZTx.defaultExpectation.paramPtrs != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by ExpectParams functions")
}
mmUpdateWithTZTx.defaultExpectation.params = &RequestRepositoryMockUpdateWithTZTxParams{ctx, tx, id, tz, generated}
mmUpdateWithTZTx.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
for _, e := range mmUpdateWithTZTx.expectations {
if minimock.Equal(e.params, mmUpdateWithTZTx.defaultExpectation.params) {
mmUpdateWithTZTx.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdateWithTZTx.defaultExpectation.params)
}
}
return mmUpdateWithTZTx
}
// ExpectCtxParam1 sets up expected param ctx for RequestRepository.UpdateWithTZTx
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) ExpectCtxParam1(ctx context.Context) *mRequestRepositoryMockUpdateWithTZTx {
if mmUpdateWithTZTx.mock.funcUpdateWithTZTx != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Set")
}
if mmUpdateWithTZTx.defaultExpectation == nil {
mmUpdateWithTZTx.defaultExpectation = &RequestRepositoryMockUpdateWithTZTxExpectation{}
}
if mmUpdateWithTZTx.defaultExpectation.params != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Expect")
}
if mmUpdateWithTZTx.defaultExpectation.paramPtrs == nil {
mmUpdateWithTZTx.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateWithTZTxParamPtrs{}
}
mmUpdateWithTZTx.defaultExpectation.paramPtrs.ctx = &ctx
mmUpdateWithTZTx.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
return mmUpdateWithTZTx
}
// ExpectTxParam2 sets up expected param tx for RequestRepository.UpdateWithTZTx
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) ExpectTxParam2(tx pgx.Tx) *mRequestRepositoryMockUpdateWithTZTx {
if mmUpdateWithTZTx.mock.funcUpdateWithTZTx != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Set")
}
if mmUpdateWithTZTx.defaultExpectation == nil {
mmUpdateWithTZTx.defaultExpectation = &RequestRepositoryMockUpdateWithTZTxExpectation{}
}
if mmUpdateWithTZTx.defaultExpectation.params != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Expect")
}
if mmUpdateWithTZTx.defaultExpectation.paramPtrs == nil {
mmUpdateWithTZTx.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateWithTZTxParamPtrs{}
}
mmUpdateWithTZTx.defaultExpectation.paramPtrs.tx = &tx
mmUpdateWithTZTx.defaultExpectation.expectationOrigins.originTx = minimock.CallerInfo(1)
return mmUpdateWithTZTx
}
// ExpectIdParam3 sets up expected param id for RequestRepository.UpdateWithTZTx
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) ExpectIdParam3(id uuid.UUID) *mRequestRepositoryMockUpdateWithTZTx {
if mmUpdateWithTZTx.mock.funcUpdateWithTZTx != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Set")
}
if mmUpdateWithTZTx.defaultExpectation == nil {
mmUpdateWithTZTx.defaultExpectation = &RequestRepositoryMockUpdateWithTZTxExpectation{}
}
if mmUpdateWithTZTx.defaultExpectation.params != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Expect")
}
if mmUpdateWithTZTx.defaultExpectation.paramPtrs == nil {
mmUpdateWithTZTx.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateWithTZTxParamPtrs{}
}
mmUpdateWithTZTx.defaultExpectation.paramPtrs.id = &id
mmUpdateWithTZTx.defaultExpectation.expectationOrigins.originId = minimock.CallerInfo(1)
return mmUpdateWithTZTx
}
// ExpectTzParam4 sets up expected param tz for RequestRepository.UpdateWithTZTx
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) ExpectTzParam4(tz string) *mRequestRepositoryMockUpdateWithTZTx {
if mmUpdateWithTZTx.mock.funcUpdateWithTZTx != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Set")
}
if mmUpdateWithTZTx.defaultExpectation == nil {
mmUpdateWithTZTx.defaultExpectation = &RequestRepositoryMockUpdateWithTZTxExpectation{}
}
if mmUpdateWithTZTx.defaultExpectation.params != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Expect")
}
if mmUpdateWithTZTx.defaultExpectation.paramPtrs == nil {
mmUpdateWithTZTx.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateWithTZTxParamPtrs{}
}
mmUpdateWithTZTx.defaultExpectation.paramPtrs.tz = &tz
mmUpdateWithTZTx.defaultExpectation.expectationOrigins.originTz = minimock.CallerInfo(1)
return mmUpdateWithTZTx
}
// ExpectGeneratedParam5 sets up expected param generated for RequestRepository.UpdateWithTZTx
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) ExpectGeneratedParam5(generated bool) *mRequestRepositoryMockUpdateWithTZTx {
if mmUpdateWithTZTx.mock.funcUpdateWithTZTx != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Set")
}
if mmUpdateWithTZTx.defaultExpectation == nil {
mmUpdateWithTZTx.defaultExpectation = &RequestRepositoryMockUpdateWithTZTxExpectation{}
}
if mmUpdateWithTZTx.defaultExpectation.params != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Expect")
}
if mmUpdateWithTZTx.defaultExpectation.paramPtrs == nil {
mmUpdateWithTZTx.defaultExpectation.paramPtrs = &RequestRepositoryMockUpdateWithTZTxParamPtrs{}
}
mmUpdateWithTZTx.defaultExpectation.paramPtrs.generated = &generated
mmUpdateWithTZTx.defaultExpectation.expectationOrigins.originGenerated = minimock.CallerInfo(1)
return mmUpdateWithTZTx
}
// Inspect accepts an inspector function that has same arguments as the RequestRepository.UpdateWithTZTx
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) Inspect(f func(ctx context.Context, tx pgx.Tx, id uuid.UUID, tz string, generated bool)) *mRequestRepositoryMockUpdateWithTZTx {
if mmUpdateWithTZTx.mock.inspectFuncUpdateWithTZTx != nil {
mmUpdateWithTZTx.mock.t.Fatalf("Inspect function is already set for RequestRepositoryMock.UpdateWithTZTx")
}
mmUpdateWithTZTx.mock.inspectFuncUpdateWithTZTx = f
return mmUpdateWithTZTx
}
// Return sets up results that will be returned by RequestRepository.UpdateWithTZTx
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) Return(err error) *RequestRepositoryMock {
if mmUpdateWithTZTx.mock.funcUpdateWithTZTx != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Set")
}
if mmUpdateWithTZTx.defaultExpectation == nil {
mmUpdateWithTZTx.defaultExpectation = &RequestRepositoryMockUpdateWithTZTxExpectation{mock: mmUpdateWithTZTx.mock}
}
mmUpdateWithTZTx.defaultExpectation.results = &RequestRepositoryMockUpdateWithTZTxResults{err}
mmUpdateWithTZTx.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
return mmUpdateWithTZTx.mock
}
// Set uses given function f to mock the RequestRepository.UpdateWithTZTx method
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) Set(f func(ctx context.Context, tx pgx.Tx, id uuid.UUID, tz string, generated bool) (err error)) *RequestRepositoryMock {
if mmUpdateWithTZTx.defaultExpectation != nil {
mmUpdateWithTZTx.mock.t.Fatalf("Default expectation is already set for the RequestRepository.UpdateWithTZTx method")
}
if len(mmUpdateWithTZTx.expectations) > 0 {
mmUpdateWithTZTx.mock.t.Fatalf("Some expectations are already set for the RequestRepository.UpdateWithTZTx method")
}
mmUpdateWithTZTx.mock.funcUpdateWithTZTx = f
mmUpdateWithTZTx.mock.funcUpdateWithTZTxOrigin = minimock.CallerInfo(1)
return mmUpdateWithTZTx.mock
}
// When sets expectation for the RequestRepository.UpdateWithTZTx which will trigger the result defined by the following
// Then helper
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) When(ctx context.Context, tx pgx.Tx, id uuid.UUID, tz string, generated bool) *RequestRepositoryMockUpdateWithTZTxExpectation {
if mmUpdateWithTZTx.mock.funcUpdateWithTZTx != nil {
mmUpdateWithTZTx.mock.t.Fatalf("RequestRepositoryMock.UpdateWithTZTx mock is already set by Set")
}
expectation := &RequestRepositoryMockUpdateWithTZTxExpectation{
mock: mmUpdateWithTZTx.mock,
params: &RequestRepositoryMockUpdateWithTZTxParams{ctx, tx, id, tz, generated},
expectationOrigins: RequestRepositoryMockUpdateWithTZTxExpectationOrigins{origin: minimock.CallerInfo(1)},
}
mmUpdateWithTZTx.expectations = append(mmUpdateWithTZTx.expectations, expectation)
return expectation
}
// Then sets up RequestRepository.UpdateWithTZTx return parameters for the expectation previously defined by the When method
func (e *RequestRepositoryMockUpdateWithTZTxExpectation) Then(err error) *RequestRepositoryMock {
e.results = &RequestRepositoryMockUpdateWithTZTxResults{err}
return e.mock
}
// Times sets number of times RequestRepository.UpdateWithTZTx should be invoked
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) Times(n uint64) *mRequestRepositoryMockUpdateWithTZTx {
if n == 0 {
mmUpdateWithTZTx.mock.t.Fatalf("Times of RequestRepositoryMock.UpdateWithTZTx mock can not be zero")
}
mm_atomic.StoreUint64(&mmUpdateWithTZTx.expectedInvocations, n)
mmUpdateWithTZTx.expectedInvocationsOrigin = minimock.CallerInfo(1)
return mmUpdateWithTZTx
}
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) invocationsDone() bool {
if len(mmUpdateWithTZTx.expectations) == 0 && mmUpdateWithTZTx.defaultExpectation == nil && mmUpdateWithTZTx.mock.funcUpdateWithTZTx == nil {
return true
}
totalInvocations := mm_atomic.LoadUint64(&mmUpdateWithTZTx.mock.afterUpdateWithTZTxCounter)
expectedInvocations := mm_atomic.LoadUint64(&mmUpdateWithTZTx.expectedInvocations)
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}
// UpdateWithTZTx implements mm_repository.RequestRepository
func (mmUpdateWithTZTx *RequestRepositoryMock) UpdateWithTZTx(ctx context.Context, tx pgx.Tx, id uuid.UUID, tz string, generated bool) (err error) {
mm_atomic.AddUint64(&mmUpdateWithTZTx.beforeUpdateWithTZTxCounter, 1)
defer mm_atomic.AddUint64(&mmUpdateWithTZTx.afterUpdateWithTZTxCounter, 1)
mmUpdateWithTZTx.t.Helper()
if mmUpdateWithTZTx.inspectFuncUpdateWithTZTx != nil {
mmUpdateWithTZTx.inspectFuncUpdateWithTZTx(ctx, tx, id, tz, generated)
}
mm_params := RequestRepositoryMockUpdateWithTZTxParams{ctx, tx, id, tz, generated}
// Record call args
mmUpdateWithTZTx.UpdateWithTZTxMock.mutex.Lock()
mmUpdateWithTZTx.UpdateWithTZTxMock.callArgs = append(mmUpdateWithTZTx.UpdateWithTZTxMock.callArgs, &mm_params)
mmUpdateWithTZTx.UpdateWithTZTxMock.mutex.Unlock()
for _, e := range mmUpdateWithTZTx.UpdateWithTZTxMock.expectations {
if minimock.Equal(*e.params, mm_params) {
mm_atomic.AddUint64(&e.Counter, 1)
return e.results.err
}
}
if mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation != nil {
mm_atomic.AddUint64(&mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation.Counter, 1)
mm_want := mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation.params
mm_want_ptrs := mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation.paramPtrs
mm_got := RequestRepositoryMockUpdateWithTZTxParams{ctx, tx, id, tz, generated}
if mm_want_ptrs != nil {
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
mmUpdateWithTZTx.t.Errorf("RequestRepositoryMock.UpdateWithTZTx got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
}
if mm_want_ptrs.tx != nil && !minimock.Equal(*mm_want_ptrs.tx, mm_got.tx) {
mmUpdateWithTZTx.t.Errorf("RequestRepositoryMock.UpdateWithTZTx got unexpected parameter tx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation.expectationOrigins.originTx, *mm_want_ptrs.tx, mm_got.tx, minimock.Diff(*mm_want_ptrs.tx, mm_got.tx))
}
if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
mmUpdateWithTZTx.t.Errorf("RequestRepositoryMock.UpdateWithTZTx got unexpected parameter id, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation.expectationOrigins.originId, *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
}
if mm_want_ptrs.tz != nil && !minimock.Equal(*mm_want_ptrs.tz, mm_got.tz) {
mmUpdateWithTZTx.t.Errorf("RequestRepositoryMock.UpdateWithTZTx got unexpected parameter tz, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation.expectationOrigins.originTz, *mm_want_ptrs.tz, mm_got.tz, minimock.Diff(*mm_want_ptrs.tz, mm_got.tz))
}
if mm_want_ptrs.generated != nil && !minimock.Equal(*mm_want_ptrs.generated, mm_got.generated) {
mmUpdateWithTZTx.t.Errorf("RequestRepositoryMock.UpdateWithTZTx got unexpected parameter generated, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation.expectationOrigins.originGenerated, *mm_want_ptrs.generated, mm_got.generated, minimock.Diff(*mm_want_ptrs.generated, mm_got.generated))
}
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
mmUpdateWithTZTx.t.Errorf("RequestRepositoryMock.UpdateWithTZTx got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
}
mm_results := mmUpdateWithTZTx.UpdateWithTZTxMock.defaultExpectation.results
if mm_results == nil {
mmUpdateWithTZTx.t.Fatal("No results are set for the RequestRepositoryMock.UpdateWithTZTx")
}
return (*mm_results).err
}
if mmUpdateWithTZTx.funcUpdateWithTZTx != nil {
return mmUpdateWithTZTx.funcUpdateWithTZTx(ctx, tx, id, tz, generated)
}
mmUpdateWithTZTx.t.Fatalf("Unexpected call to RequestRepositoryMock.UpdateWithTZTx. %v %v %v %v %v", ctx, tx, id, tz, generated)
return
}
// UpdateWithTZTxAfterCounter returns a count of finished RequestRepositoryMock.UpdateWithTZTx invocations
func (mmUpdateWithTZTx *RequestRepositoryMock) UpdateWithTZTxAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmUpdateWithTZTx.afterUpdateWithTZTxCounter)
}
// UpdateWithTZTxBeforeCounter returns a count of RequestRepositoryMock.UpdateWithTZTx invocations
func (mmUpdateWithTZTx *RequestRepositoryMock) UpdateWithTZTxBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmUpdateWithTZTx.beforeUpdateWithTZTxCounter)
}
// Calls returns a list of arguments used in each call to RequestRepositoryMock.UpdateWithTZTx.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmUpdateWithTZTx *mRequestRepositoryMockUpdateWithTZTx) Calls() []*RequestRepositoryMockUpdateWithTZTxParams {
mmUpdateWithTZTx.mutex.RLock()
argCopy := make([]*RequestRepositoryMockUpdateWithTZTxParams, len(mmUpdateWithTZTx.callArgs))
copy(argCopy, mmUpdateWithTZTx.callArgs)
mmUpdateWithTZTx.mutex.RUnlock()
return argCopy
}
// MinimockUpdateWithTZTxDone returns true if the count of the UpdateWithTZTx invocations corresponds
// the number of defined expectations
func (m *RequestRepositoryMock) MinimockUpdateWithTZTxDone() bool {
if m.UpdateWithTZTxMock.optional {
// Optional methods provide '0 or more' call count restriction.
return true
}
for _, e := range m.UpdateWithTZTxMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
return m.UpdateWithTZTxMock.invocationsDone()
}
// MinimockUpdateWithTZTxInspect logs each unmet expectation
func (m *RequestRepositoryMock) MinimockUpdateWithTZTxInspect() {
for _, e := range m.UpdateWithTZTxMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateWithTZTx at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
}
}
afterUpdateWithTZTxCounter := mm_atomic.LoadUint64(&m.afterUpdateWithTZTxCounter)
// if default expectation was set then invocations count should be greater than zero
if m.UpdateWithTZTxMock.defaultExpectation != nil && afterUpdateWithTZTxCounter < 1 {
if m.UpdateWithTZTxMock.defaultExpectation.params == nil {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateWithTZTx at\n%s", m.UpdateWithTZTxMock.defaultExpectation.returnOrigin)
} else {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateWithTZTx at\n%s with params: %#v", m.UpdateWithTZTxMock.defaultExpectation.expectationOrigins.origin, *m.UpdateWithTZTxMock.defaultExpectation.params)
}
}
// if func was set then invocations count should be greater than zero
if m.funcUpdateWithTZTx != nil && afterUpdateWithTZTxCounter < 1 {
m.t.Errorf("Expected call to RequestRepositoryMock.UpdateWithTZTx at\n%s", m.funcUpdateWithTZTxOrigin)
}
if !m.UpdateWithTZTxMock.invocationsDone() && afterUpdateWithTZTxCounter > 0 {
m.t.Errorf("Expected %d calls to RequestRepositoryMock.UpdateWithTZTx at\n%s but found %d calls",
mm_atomic.LoadUint64(&m.UpdateWithTZTxMock.expectedInvocations), m.UpdateWithTZTxMock.expectedInvocationsOrigin, afterUpdateWithTZTxCounter)
}
}
// MinimockFinish checks that all mocked methods have been called the expected number of times
func (m *RequestRepositoryMock) MinimockFinish() {
m.finishOnce.Do(func() {
if !m.minimockDone() {
m.MinimockCheckOwnershipInspect()
m.MinimockCreateInspect()
m.MinimockGetByIDInspect()
m.MinimockGetByUserIDInspect()
m.MinimockGetDetailByIDInspect()
m.MinimockGetUserStatisticsInspect()
m.MinimockUpdateFinalTZInspect()
m.MinimockUpdateWithTZInspect()
m.MinimockUpdateWithTZTxInspect()
}
})
}
// MinimockWait waits for all mocked methods to be called the expected number of times
func (m *RequestRepositoryMock) 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 *RequestRepositoryMock) minimockDone() bool {
done := true
return done &&
m.MinimockCheckOwnershipDone() &&
m.MinimockCreateDone() &&
m.MinimockGetByIDDone() &&
m.MinimockGetByUserIDDone() &&
m.MinimockGetDetailByIDDone() &&
m.MinimockGetUserStatisticsDone() &&
m.MinimockUpdateFinalTZDone() &&
m.MinimockUpdateWithTZDone() &&
m.MinimockUpdateWithTZTxDone()
}