// Code generated by http://github.com/gojuno/minimock (v3.4.0). DO NOT EDIT.

package mock

//go:generate minimock -i route256/loms/internal/domain/service.StockRepository -o stock_repository_mock.go -n StockRepositoryMock -p mock

import (
	"context"
	"route256/loms/internal/domain/entity"
	"sync"
	mm_atomic "sync/atomic"
	mm_time "time"

	"github.com/gojuno/minimock/v3"
)

// StockRepositoryMock implements mm_service.StockRepository
type StockRepositoryMock struct {
	t          minimock.Tester
	finishOnce sync.Once

	funcStockCancel          func(ctx context.Context, stock *entity.Stock) (err error)
	funcStockCancelOrigin    string
	inspectFuncStockCancel   func(ctx context.Context, stock *entity.Stock)
	afterStockCancelCounter  uint64
	beforeStockCancelCounter uint64
	StockCancelMock          mStockRepositoryMockStockCancel

	funcStockGetByID          func(ctx context.Context, sku entity.Sku) (sp1 *entity.Stock, err error)
	funcStockGetByIDOrigin    string
	inspectFuncStockGetByID   func(ctx context.Context, sku entity.Sku)
	afterStockGetByIDCounter  uint64
	beforeStockGetByIDCounter uint64
	StockGetByIDMock          mStockRepositoryMockStockGetByID

	funcStockReserve          func(ctx context.Context, stock *entity.Stock) (err error)
	funcStockReserveOrigin    string
	inspectFuncStockReserve   func(ctx context.Context, stock *entity.Stock)
	afterStockReserveCounter  uint64
	beforeStockReserveCounter uint64
	StockReserveMock          mStockRepositoryMockStockReserve

	funcStockReserveRemove          func(ctx context.Context, stock *entity.Stock) (err error)
	funcStockReserveRemoveOrigin    string
	inspectFuncStockReserveRemove   func(ctx context.Context, stock *entity.Stock)
	afterStockReserveRemoveCounter  uint64
	beforeStockReserveRemoveCounter uint64
	StockReserveRemoveMock          mStockRepositoryMockStockReserveRemove
}

// NewStockRepositoryMock returns a mock for mm_service.StockRepository
func NewStockRepositoryMock(t minimock.Tester) *StockRepositoryMock {
	m := &StockRepositoryMock{t: t}

	if controller, ok := t.(minimock.MockController); ok {
		controller.RegisterMocker(m)
	}

	m.StockCancelMock = mStockRepositoryMockStockCancel{mock: m}
	m.StockCancelMock.callArgs = []*StockRepositoryMockStockCancelParams{}

	m.StockGetByIDMock = mStockRepositoryMockStockGetByID{mock: m}
	m.StockGetByIDMock.callArgs = []*StockRepositoryMockStockGetByIDParams{}

	m.StockReserveMock = mStockRepositoryMockStockReserve{mock: m}
	m.StockReserveMock.callArgs = []*StockRepositoryMockStockReserveParams{}

	m.StockReserveRemoveMock = mStockRepositoryMockStockReserveRemove{mock: m}
	m.StockReserveRemoveMock.callArgs = []*StockRepositoryMockStockReserveRemoveParams{}

	t.Cleanup(m.MinimockFinish)

	return m
}

type mStockRepositoryMockStockCancel struct {
	optional           bool
	mock               *StockRepositoryMock
	defaultExpectation *StockRepositoryMockStockCancelExpectation
	expectations       []*StockRepositoryMockStockCancelExpectation

	callArgs []*StockRepositoryMockStockCancelParams
	mutex    sync.RWMutex

	expectedInvocations       uint64
	expectedInvocationsOrigin string
}

// StockRepositoryMockStockCancelExpectation specifies expectation struct of the StockRepository.StockCancel
type StockRepositoryMockStockCancelExpectation struct {
	mock               *StockRepositoryMock
	params             *StockRepositoryMockStockCancelParams
	paramPtrs          *StockRepositoryMockStockCancelParamPtrs
	expectationOrigins StockRepositoryMockStockCancelExpectationOrigins
	results            *StockRepositoryMockStockCancelResults
	returnOrigin       string
	Counter            uint64
}

// StockRepositoryMockStockCancelParams contains parameters of the StockRepository.StockCancel
type StockRepositoryMockStockCancelParams struct {
	ctx   context.Context
	stock *entity.Stock
}

// StockRepositoryMockStockCancelParamPtrs contains pointers to parameters of the StockRepository.StockCancel
type StockRepositoryMockStockCancelParamPtrs struct {
	ctx   *context.Context
	stock **entity.Stock
}

// StockRepositoryMockStockCancelResults contains results of the StockRepository.StockCancel
type StockRepositoryMockStockCancelResults struct {
	err error
}

// StockRepositoryMockStockCancelOrigins contains origins of expectations of the StockRepository.StockCancel
type StockRepositoryMockStockCancelExpectationOrigins struct {
	origin      string
	originCtx   string
	originStock 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 (mmStockCancel *mStockRepositoryMockStockCancel) Optional() *mStockRepositoryMockStockCancel {
	mmStockCancel.optional = true
	return mmStockCancel
}

// Expect sets up expected params for StockRepository.StockCancel
func (mmStockCancel *mStockRepositoryMockStockCancel) Expect(ctx context.Context, stock *entity.Stock) *mStockRepositoryMockStockCancel {
	if mmStockCancel.mock.funcStockCancel != nil {
		mmStockCancel.mock.t.Fatalf("StockRepositoryMock.StockCancel mock is already set by Set")
	}

	if mmStockCancel.defaultExpectation == nil {
		mmStockCancel.defaultExpectation = &StockRepositoryMockStockCancelExpectation{}
	}

	if mmStockCancel.defaultExpectation.paramPtrs != nil {
		mmStockCancel.mock.t.Fatalf("StockRepositoryMock.StockCancel mock is already set by ExpectParams functions")
	}

	mmStockCancel.defaultExpectation.params = &StockRepositoryMockStockCancelParams{ctx, stock}
	mmStockCancel.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
	for _, e := range mmStockCancel.expectations {
		if minimock.Equal(e.params, mmStockCancel.defaultExpectation.params) {
			mmStockCancel.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmStockCancel.defaultExpectation.params)
		}
	}

	return mmStockCancel
}

// ExpectCtxParam1 sets up expected param ctx for StockRepository.StockCancel
func (mmStockCancel *mStockRepositoryMockStockCancel) ExpectCtxParam1(ctx context.Context) *mStockRepositoryMockStockCancel {
	if mmStockCancel.mock.funcStockCancel != nil {
		mmStockCancel.mock.t.Fatalf("StockRepositoryMock.StockCancel mock is already set by Set")
	}

	if mmStockCancel.defaultExpectation == nil {
		mmStockCancel.defaultExpectation = &StockRepositoryMockStockCancelExpectation{}
	}

	if mmStockCancel.defaultExpectation.params != nil {
		mmStockCancel.mock.t.Fatalf("StockRepositoryMock.StockCancel mock is already set by Expect")
	}

	if mmStockCancel.defaultExpectation.paramPtrs == nil {
		mmStockCancel.defaultExpectation.paramPtrs = &StockRepositoryMockStockCancelParamPtrs{}
	}
	mmStockCancel.defaultExpectation.paramPtrs.ctx = &ctx
	mmStockCancel.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)

	return mmStockCancel
}

// ExpectStockParam2 sets up expected param stock for StockRepository.StockCancel
func (mmStockCancel *mStockRepositoryMockStockCancel) ExpectStockParam2(stock *entity.Stock) *mStockRepositoryMockStockCancel {
	if mmStockCancel.mock.funcStockCancel != nil {
		mmStockCancel.mock.t.Fatalf("StockRepositoryMock.StockCancel mock is already set by Set")
	}

	if mmStockCancel.defaultExpectation == nil {
		mmStockCancel.defaultExpectation = &StockRepositoryMockStockCancelExpectation{}
	}

	if mmStockCancel.defaultExpectation.params != nil {
		mmStockCancel.mock.t.Fatalf("StockRepositoryMock.StockCancel mock is already set by Expect")
	}

	if mmStockCancel.defaultExpectation.paramPtrs == nil {
		mmStockCancel.defaultExpectation.paramPtrs = &StockRepositoryMockStockCancelParamPtrs{}
	}
	mmStockCancel.defaultExpectation.paramPtrs.stock = &stock
	mmStockCancel.defaultExpectation.expectationOrigins.originStock = minimock.CallerInfo(1)

	return mmStockCancel
}

// Inspect accepts an inspector function that has same arguments as the StockRepository.StockCancel
func (mmStockCancel *mStockRepositoryMockStockCancel) Inspect(f func(ctx context.Context, stock *entity.Stock)) *mStockRepositoryMockStockCancel {
	if mmStockCancel.mock.inspectFuncStockCancel != nil {
		mmStockCancel.mock.t.Fatalf("Inspect function is already set for StockRepositoryMock.StockCancel")
	}

	mmStockCancel.mock.inspectFuncStockCancel = f

	return mmStockCancel
}

// Return sets up results that will be returned by StockRepository.StockCancel
func (mmStockCancel *mStockRepositoryMockStockCancel) Return(err error) *StockRepositoryMock {
	if mmStockCancel.mock.funcStockCancel != nil {
		mmStockCancel.mock.t.Fatalf("StockRepositoryMock.StockCancel mock is already set by Set")
	}

	if mmStockCancel.defaultExpectation == nil {
		mmStockCancel.defaultExpectation = &StockRepositoryMockStockCancelExpectation{mock: mmStockCancel.mock}
	}
	mmStockCancel.defaultExpectation.results = &StockRepositoryMockStockCancelResults{err}
	mmStockCancel.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
	return mmStockCancel.mock
}

// Set uses given function f to mock the StockRepository.StockCancel method
func (mmStockCancel *mStockRepositoryMockStockCancel) Set(f func(ctx context.Context, stock *entity.Stock) (err error)) *StockRepositoryMock {
	if mmStockCancel.defaultExpectation != nil {
		mmStockCancel.mock.t.Fatalf("Default expectation is already set for the StockRepository.StockCancel method")
	}

	if len(mmStockCancel.expectations) > 0 {
		mmStockCancel.mock.t.Fatalf("Some expectations are already set for the StockRepository.StockCancel method")
	}

	mmStockCancel.mock.funcStockCancel = f
	mmStockCancel.mock.funcStockCancelOrigin = minimock.CallerInfo(1)
	return mmStockCancel.mock
}

// When sets expectation for the StockRepository.StockCancel which will trigger the result defined by the following
// Then helper
func (mmStockCancel *mStockRepositoryMockStockCancel) When(ctx context.Context, stock *entity.Stock) *StockRepositoryMockStockCancelExpectation {
	if mmStockCancel.mock.funcStockCancel != nil {
		mmStockCancel.mock.t.Fatalf("StockRepositoryMock.StockCancel mock is already set by Set")
	}

	expectation := &StockRepositoryMockStockCancelExpectation{
		mock:               mmStockCancel.mock,
		params:             &StockRepositoryMockStockCancelParams{ctx, stock},
		expectationOrigins: StockRepositoryMockStockCancelExpectationOrigins{origin: minimock.CallerInfo(1)},
	}
	mmStockCancel.expectations = append(mmStockCancel.expectations, expectation)
	return expectation
}

// Then sets up StockRepository.StockCancel return parameters for the expectation previously defined by the When method
func (e *StockRepositoryMockStockCancelExpectation) Then(err error) *StockRepositoryMock {
	e.results = &StockRepositoryMockStockCancelResults{err}
	return e.mock
}

// Times sets number of times StockRepository.StockCancel should be invoked
func (mmStockCancel *mStockRepositoryMockStockCancel) Times(n uint64) *mStockRepositoryMockStockCancel {
	if n == 0 {
		mmStockCancel.mock.t.Fatalf("Times of StockRepositoryMock.StockCancel mock can not be zero")
	}
	mm_atomic.StoreUint64(&mmStockCancel.expectedInvocations, n)
	mmStockCancel.expectedInvocationsOrigin = minimock.CallerInfo(1)
	return mmStockCancel
}

func (mmStockCancel *mStockRepositoryMockStockCancel) invocationsDone() bool {
	if len(mmStockCancel.expectations) == 0 && mmStockCancel.defaultExpectation == nil && mmStockCancel.mock.funcStockCancel == nil {
		return true
	}

	totalInvocations := mm_atomic.LoadUint64(&mmStockCancel.mock.afterStockCancelCounter)
	expectedInvocations := mm_atomic.LoadUint64(&mmStockCancel.expectedInvocations)

	return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}

// StockCancel implements mm_service.StockRepository
func (mmStockCancel *StockRepositoryMock) StockCancel(ctx context.Context, stock *entity.Stock) (err error) {
	mm_atomic.AddUint64(&mmStockCancel.beforeStockCancelCounter, 1)
	defer mm_atomic.AddUint64(&mmStockCancel.afterStockCancelCounter, 1)

	mmStockCancel.t.Helper()

	if mmStockCancel.inspectFuncStockCancel != nil {
		mmStockCancel.inspectFuncStockCancel(ctx, stock)
	}

	mm_params := StockRepositoryMockStockCancelParams{ctx, stock}

	// Record call args
	mmStockCancel.StockCancelMock.mutex.Lock()
	mmStockCancel.StockCancelMock.callArgs = append(mmStockCancel.StockCancelMock.callArgs, &mm_params)
	mmStockCancel.StockCancelMock.mutex.Unlock()

	for _, e := range mmStockCancel.StockCancelMock.expectations {
		if minimock.Equal(*e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmStockCancel.StockCancelMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmStockCancel.StockCancelMock.defaultExpectation.Counter, 1)
		mm_want := mmStockCancel.StockCancelMock.defaultExpectation.params
		mm_want_ptrs := mmStockCancel.StockCancelMock.defaultExpectation.paramPtrs

		mm_got := StockRepositoryMockStockCancelParams{ctx, stock}

		if mm_want_ptrs != nil {

			if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
				mmStockCancel.t.Errorf("StockRepositoryMock.StockCancel got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
					mmStockCancel.StockCancelMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
			}

			if mm_want_ptrs.stock != nil && !minimock.Equal(*mm_want_ptrs.stock, mm_got.stock) {
				mmStockCancel.t.Errorf("StockRepositoryMock.StockCancel got unexpected parameter stock, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
					mmStockCancel.StockCancelMock.defaultExpectation.expectationOrigins.originStock, *mm_want_ptrs.stock, mm_got.stock, minimock.Diff(*mm_want_ptrs.stock, mm_got.stock))
			}

		} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmStockCancel.t.Errorf("StockRepositoryMock.StockCancel got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
				mmStockCancel.StockCancelMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmStockCancel.StockCancelMock.defaultExpectation.results
		if mm_results == nil {
			mmStockCancel.t.Fatal("No results are set for the StockRepositoryMock.StockCancel")
		}
		return (*mm_results).err
	}
	if mmStockCancel.funcStockCancel != nil {
		return mmStockCancel.funcStockCancel(ctx, stock)
	}
	mmStockCancel.t.Fatalf("Unexpected call to StockRepositoryMock.StockCancel. %v %v", ctx, stock)
	return
}

// StockCancelAfterCounter returns a count of finished StockRepositoryMock.StockCancel invocations
func (mmStockCancel *StockRepositoryMock) StockCancelAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmStockCancel.afterStockCancelCounter)
}

// StockCancelBeforeCounter returns a count of StockRepositoryMock.StockCancel invocations
func (mmStockCancel *StockRepositoryMock) StockCancelBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmStockCancel.beforeStockCancelCounter)
}

// Calls returns a list of arguments used in each call to StockRepositoryMock.StockCancel.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmStockCancel *mStockRepositoryMockStockCancel) Calls() []*StockRepositoryMockStockCancelParams {
	mmStockCancel.mutex.RLock()

	argCopy := make([]*StockRepositoryMockStockCancelParams, len(mmStockCancel.callArgs))
	copy(argCopy, mmStockCancel.callArgs)

	mmStockCancel.mutex.RUnlock()

	return argCopy
}

// MinimockStockCancelDone returns true if the count of the StockCancel invocations corresponds
// the number of defined expectations
func (m *StockRepositoryMock) MinimockStockCancelDone() bool {
	if m.StockCancelMock.optional {
		// Optional methods provide '0 or more' call count restriction.
		return true
	}

	for _, e := range m.StockCancelMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	return m.StockCancelMock.invocationsDone()
}

// MinimockStockCancelInspect logs each unmet expectation
func (m *StockRepositoryMock) MinimockStockCancelInspect() {
	for _, e := range m.StockCancelMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to StockRepositoryMock.StockCancel at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
		}
	}

	afterStockCancelCounter := mm_atomic.LoadUint64(&m.afterStockCancelCounter)
	// if default expectation was set then invocations count should be greater than zero
	if m.StockCancelMock.defaultExpectation != nil && afterStockCancelCounter < 1 {
		if m.StockCancelMock.defaultExpectation.params == nil {
			m.t.Errorf("Expected call to StockRepositoryMock.StockCancel at\n%s", m.StockCancelMock.defaultExpectation.returnOrigin)
		} else {
			m.t.Errorf("Expected call to StockRepositoryMock.StockCancel at\n%s with params: %#v", m.StockCancelMock.defaultExpectation.expectationOrigins.origin, *m.StockCancelMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcStockCancel != nil && afterStockCancelCounter < 1 {
		m.t.Errorf("Expected call to StockRepositoryMock.StockCancel at\n%s", m.funcStockCancelOrigin)
	}

	if !m.StockCancelMock.invocationsDone() && afterStockCancelCounter > 0 {
		m.t.Errorf("Expected %d calls to StockRepositoryMock.StockCancel at\n%s but found %d calls",
			mm_atomic.LoadUint64(&m.StockCancelMock.expectedInvocations), m.StockCancelMock.expectedInvocationsOrigin, afterStockCancelCounter)
	}
}

type mStockRepositoryMockStockGetByID struct {
	optional           bool
	mock               *StockRepositoryMock
	defaultExpectation *StockRepositoryMockStockGetByIDExpectation
	expectations       []*StockRepositoryMockStockGetByIDExpectation

	callArgs []*StockRepositoryMockStockGetByIDParams
	mutex    sync.RWMutex

	expectedInvocations       uint64
	expectedInvocationsOrigin string
}

// StockRepositoryMockStockGetByIDExpectation specifies expectation struct of the StockRepository.StockGetByID
type StockRepositoryMockStockGetByIDExpectation struct {
	mock               *StockRepositoryMock
	params             *StockRepositoryMockStockGetByIDParams
	paramPtrs          *StockRepositoryMockStockGetByIDParamPtrs
	expectationOrigins StockRepositoryMockStockGetByIDExpectationOrigins
	results            *StockRepositoryMockStockGetByIDResults
	returnOrigin       string
	Counter            uint64
}

// StockRepositoryMockStockGetByIDParams contains parameters of the StockRepository.StockGetByID
type StockRepositoryMockStockGetByIDParams struct {
	ctx context.Context
	sku entity.Sku
}

// StockRepositoryMockStockGetByIDParamPtrs contains pointers to parameters of the StockRepository.StockGetByID
type StockRepositoryMockStockGetByIDParamPtrs struct {
	ctx *context.Context
	sku *entity.Sku
}

// StockRepositoryMockStockGetByIDResults contains results of the StockRepository.StockGetByID
type StockRepositoryMockStockGetByIDResults struct {
	sp1 *entity.Stock
	err error
}

// StockRepositoryMockStockGetByIDOrigins contains origins of expectations of the StockRepository.StockGetByID
type StockRepositoryMockStockGetByIDExpectationOrigins struct {
	origin    string
	originCtx string
	originSku 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 (mmStockGetByID *mStockRepositoryMockStockGetByID) Optional() *mStockRepositoryMockStockGetByID {
	mmStockGetByID.optional = true
	return mmStockGetByID
}

// Expect sets up expected params for StockRepository.StockGetByID
func (mmStockGetByID *mStockRepositoryMockStockGetByID) Expect(ctx context.Context, sku entity.Sku) *mStockRepositoryMockStockGetByID {
	if mmStockGetByID.mock.funcStockGetByID != nil {
		mmStockGetByID.mock.t.Fatalf("StockRepositoryMock.StockGetByID mock is already set by Set")
	}

	if mmStockGetByID.defaultExpectation == nil {
		mmStockGetByID.defaultExpectation = &StockRepositoryMockStockGetByIDExpectation{}
	}

	if mmStockGetByID.defaultExpectation.paramPtrs != nil {
		mmStockGetByID.mock.t.Fatalf("StockRepositoryMock.StockGetByID mock is already set by ExpectParams functions")
	}

	mmStockGetByID.defaultExpectation.params = &StockRepositoryMockStockGetByIDParams{ctx, sku}
	mmStockGetByID.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
	for _, e := range mmStockGetByID.expectations {
		if minimock.Equal(e.params, mmStockGetByID.defaultExpectation.params) {
			mmStockGetByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmStockGetByID.defaultExpectation.params)
		}
	}

	return mmStockGetByID
}

// ExpectCtxParam1 sets up expected param ctx for StockRepository.StockGetByID
func (mmStockGetByID *mStockRepositoryMockStockGetByID) ExpectCtxParam1(ctx context.Context) *mStockRepositoryMockStockGetByID {
	if mmStockGetByID.mock.funcStockGetByID != nil {
		mmStockGetByID.mock.t.Fatalf("StockRepositoryMock.StockGetByID mock is already set by Set")
	}

	if mmStockGetByID.defaultExpectation == nil {
		mmStockGetByID.defaultExpectation = &StockRepositoryMockStockGetByIDExpectation{}
	}

	if mmStockGetByID.defaultExpectation.params != nil {
		mmStockGetByID.mock.t.Fatalf("StockRepositoryMock.StockGetByID mock is already set by Expect")
	}

	if mmStockGetByID.defaultExpectation.paramPtrs == nil {
		mmStockGetByID.defaultExpectation.paramPtrs = &StockRepositoryMockStockGetByIDParamPtrs{}
	}
	mmStockGetByID.defaultExpectation.paramPtrs.ctx = &ctx
	mmStockGetByID.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)

	return mmStockGetByID
}

// ExpectSkuParam2 sets up expected param sku for StockRepository.StockGetByID
func (mmStockGetByID *mStockRepositoryMockStockGetByID) ExpectSkuParam2(sku entity.Sku) *mStockRepositoryMockStockGetByID {
	if mmStockGetByID.mock.funcStockGetByID != nil {
		mmStockGetByID.mock.t.Fatalf("StockRepositoryMock.StockGetByID mock is already set by Set")
	}

	if mmStockGetByID.defaultExpectation == nil {
		mmStockGetByID.defaultExpectation = &StockRepositoryMockStockGetByIDExpectation{}
	}

	if mmStockGetByID.defaultExpectation.params != nil {
		mmStockGetByID.mock.t.Fatalf("StockRepositoryMock.StockGetByID mock is already set by Expect")
	}

	if mmStockGetByID.defaultExpectation.paramPtrs == nil {
		mmStockGetByID.defaultExpectation.paramPtrs = &StockRepositoryMockStockGetByIDParamPtrs{}
	}
	mmStockGetByID.defaultExpectation.paramPtrs.sku = &sku
	mmStockGetByID.defaultExpectation.expectationOrigins.originSku = minimock.CallerInfo(1)

	return mmStockGetByID
}

// Inspect accepts an inspector function that has same arguments as the StockRepository.StockGetByID
func (mmStockGetByID *mStockRepositoryMockStockGetByID) Inspect(f func(ctx context.Context, sku entity.Sku)) *mStockRepositoryMockStockGetByID {
	if mmStockGetByID.mock.inspectFuncStockGetByID != nil {
		mmStockGetByID.mock.t.Fatalf("Inspect function is already set for StockRepositoryMock.StockGetByID")
	}

	mmStockGetByID.mock.inspectFuncStockGetByID = f

	return mmStockGetByID
}

// Return sets up results that will be returned by StockRepository.StockGetByID
func (mmStockGetByID *mStockRepositoryMockStockGetByID) Return(sp1 *entity.Stock, err error) *StockRepositoryMock {
	if mmStockGetByID.mock.funcStockGetByID != nil {
		mmStockGetByID.mock.t.Fatalf("StockRepositoryMock.StockGetByID mock is already set by Set")
	}

	if mmStockGetByID.defaultExpectation == nil {
		mmStockGetByID.defaultExpectation = &StockRepositoryMockStockGetByIDExpectation{mock: mmStockGetByID.mock}
	}
	mmStockGetByID.defaultExpectation.results = &StockRepositoryMockStockGetByIDResults{sp1, err}
	mmStockGetByID.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
	return mmStockGetByID.mock
}

// Set uses given function f to mock the StockRepository.StockGetByID method
func (mmStockGetByID *mStockRepositoryMockStockGetByID) Set(f func(ctx context.Context, sku entity.Sku) (sp1 *entity.Stock, err error)) *StockRepositoryMock {
	if mmStockGetByID.defaultExpectation != nil {
		mmStockGetByID.mock.t.Fatalf("Default expectation is already set for the StockRepository.StockGetByID method")
	}

	if len(mmStockGetByID.expectations) > 0 {
		mmStockGetByID.mock.t.Fatalf("Some expectations are already set for the StockRepository.StockGetByID method")
	}

	mmStockGetByID.mock.funcStockGetByID = f
	mmStockGetByID.mock.funcStockGetByIDOrigin = minimock.CallerInfo(1)
	return mmStockGetByID.mock
}

// When sets expectation for the StockRepository.StockGetByID which will trigger the result defined by the following
// Then helper
func (mmStockGetByID *mStockRepositoryMockStockGetByID) When(ctx context.Context, sku entity.Sku) *StockRepositoryMockStockGetByIDExpectation {
	if mmStockGetByID.mock.funcStockGetByID != nil {
		mmStockGetByID.mock.t.Fatalf("StockRepositoryMock.StockGetByID mock is already set by Set")
	}

	expectation := &StockRepositoryMockStockGetByIDExpectation{
		mock:               mmStockGetByID.mock,
		params:             &StockRepositoryMockStockGetByIDParams{ctx, sku},
		expectationOrigins: StockRepositoryMockStockGetByIDExpectationOrigins{origin: minimock.CallerInfo(1)},
	}
	mmStockGetByID.expectations = append(mmStockGetByID.expectations, expectation)
	return expectation
}

// Then sets up StockRepository.StockGetByID return parameters for the expectation previously defined by the When method
func (e *StockRepositoryMockStockGetByIDExpectation) Then(sp1 *entity.Stock, err error) *StockRepositoryMock {
	e.results = &StockRepositoryMockStockGetByIDResults{sp1, err}
	return e.mock
}

// Times sets number of times StockRepository.StockGetByID should be invoked
func (mmStockGetByID *mStockRepositoryMockStockGetByID) Times(n uint64) *mStockRepositoryMockStockGetByID {
	if n == 0 {
		mmStockGetByID.mock.t.Fatalf("Times of StockRepositoryMock.StockGetByID mock can not be zero")
	}
	mm_atomic.StoreUint64(&mmStockGetByID.expectedInvocations, n)
	mmStockGetByID.expectedInvocationsOrigin = minimock.CallerInfo(1)
	return mmStockGetByID
}

func (mmStockGetByID *mStockRepositoryMockStockGetByID) invocationsDone() bool {
	if len(mmStockGetByID.expectations) == 0 && mmStockGetByID.defaultExpectation == nil && mmStockGetByID.mock.funcStockGetByID == nil {
		return true
	}

	totalInvocations := mm_atomic.LoadUint64(&mmStockGetByID.mock.afterStockGetByIDCounter)
	expectedInvocations := mm_atomic.LoadUint64(&mmStockGetByID.expectedInvocations)

	return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}

// StockGetByID implements mm_service.StockRepository
func (mmStockGetByID *StockRepositoryMock) StockGetByID(ctx context.Context, sku entity.Sku) (sp1 *entity.Stock, err error) {
	mm_atomic.AddUint64(&mmStockGetByID.beforeStockGetByIDCounter, 1)
	defer mm_atomic.AddUint64(&mmStockGetByID.afterStockGetByIDCounter, 1)

	mmStockGetByID.t.Helper()

	if mmStockGetByID.inspectFuncStockGetByID != nil {
		mmStockGetByID.inspectFuncStockGetByID(ctx, sku)
	}

	mm_params := StockRepositoryMockStockGetByIDParams{ctx, sku}

	// Record call args
	mmStockGetByID.StockGetByIDMock.mutex.Lock()
	mmStockGetByID.StockGetByIDMock.callArgs = append(mmStockGetByID.StockGetByIDMock.callArgs, &mm_params)
	mmStockGetByID.StockGetByIDMock.mutex.Unlock()

	for _, e := range mmStockGetByID.StockGetByIDMock.expectations {
		if minimock.Equal(*e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.sp1, e.results.err
		}
	}

	if mmStockGetByID.StockGetByIDMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmStockGetByID.StockGetByIDMock.defaultExpectation.Counter, 1)
		mm_want := mmStockGetByID.StockGetByIDMock.defaultExpectation.params
		mm_want_ptrs := mmStockGetByID.StockGetByIDMock.defaultExpectation.paramPtrs

		mm_got := StockRepositoryMockStockGetByIDParams{ctx, sku}

		if mm_want_ptrs != nil {

			if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
				mmStockGetByID.t.Errorf("StockRepositoryMock.StockGetByID got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
					mmStockGetByID.StockGetByIDMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
			}

			if mm_want_ptrs.sku != nil && !minimock.Equal(*mm_want_ptrs.sku, mm_got.sku) {
				mmStockGetByID.t.Errorf("StockRepositoryMock.StockGetByID got unexpected parameter sku, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
					mmStockGetByID.StockGetByIDMock.defaultExpectation.expectationOrigins.originSku, *mm_want_ptrs.sku, mm_got.sku, minimock.Diff(*mm_want_ptrs.sku, mm_got.sku))
			}

		} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmStockGetByID.t.Errorf("StockRepositoryMock.StockGetByID got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
				mmStockGetByID.StockGetByIDMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmStockGetByID.StockGetByIDMock.defaultExpectation.results
		if mm_results == nil {
			mmStockGetByID.t.Fatal("No results are set for the StockRepositoryMock.StockGetByID")
		}
		return (*mm_results).sp1, (*mm_results).err
	}
	if mmStockGetByID.funcStockGetByID != nil {
		return mmStockGetByID.funcStockGetByID(ctx, sku)
	}
	mmStockGetByID.t.Fatalf("Unexpected call to StockRepositoryMock.StockGetByID. %v %v", ctx, sku)
	return
}

// StockGetByIDAfterCounter returns a count of finished StockRepositoryMock.StockGetByID invocations
func (mmStockGetByID *StockRepositoryMock) StockGetByIDAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmStockGetByID.afterStockGetByIDCounter)
}

// StockGetByIDBeforeCounter returns a count of StockRepositoryMock.StockGetByID invocations
func (mmStockGetByID *StockRepositoryMock) StockGetByIDBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmStockGetByID.beforeStockGetByIDCounter)
}

// Calls returns a list of arguments used in each call to StockRepositoryMock.StockGetByID.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmStockGetByID *mStockRepositoryMockStockGetByID) Calls() []*StockRepositoryMockStockGetByIDParams {
	mmStockGetByID.mutex.RLock()

	argCopy := make([]*StockRepositoryMockStockGetByIDParams, len(mmStockGetByID.callArgs))
	copy(argCopy, mmStockGetByID.callArgs)

	mmStockGetByID.mutex.RUnlock()

	return argCopy
}

// MinimockStockGetByIDDone returns true if the count of the StockGetByID invocations corresponds
// the number of defined expectations
func (m *StockRepositoryMock) MinimockStockGetByIDDone() bool {
	if m.StockGetByIDMock.optional {
		// Optional methods provide '0 or more' call count restriction.
		return true
	}

	for _, e := range m.StockGetByIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	return m.StockGetByIDMock.invocationsDone()
}

// MinimockStockGetByIDInspect logs each unmet expectation
func (m *StockRepositoryMock) MinimockStockGetByIDInspect() {
	for _, e := range m.StockGetByIDMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to StockRepositoryMock.StockGetByID at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
		}
	}

	afterStockGetByIDCounter := mm_atomic.LoadUint64(&m.afterStockGetByIDCounter)
	// if default expectation was set then invocations count should be greater than zero
	if m.StockGetByIDMock.defaultExpectation != nil && afterStockGetByIDCounter < 1 {
		if m.StockGetByIDMock.defaultExpectation.params == nil {
			m.t.Errorf("Expected call to StockRepositoryMock.StockGetByID at\n%s", m.StockGetByIDMock.defaultExpectation.returnOrigin)
		} else {
			m.t.Errorf("Expected call to StockRepositoryMock.StockGetByID at\n%s with params: %#v", m.StockGetByIDMock.defaultExpectation.expectationOrigins.origin, *m.StockGetByIDMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcStockGetByID != nil && afterStockGetByIDCounter < 1 {
		m.t.Errorf("Expected call to StockRepositoryMock.StockGetByID at\n%s", m.funcStockGetByIDOrigin)
	}

	if !m.StockGetByIDMock.invocationsDone() && afterStockGetByIDCounter > 0 {
		m.t.Errorf("Expected %d calls to StockRepositoryMock.StockGetByID at\n%s but found %d calls",
			mm_atomic.LoadUint64(&m.StockGetByIDMock.expectedInvocations), m.StockGetByIDMock.expectedInvocationsOrigin, afterStockGetByIDCounter)
	}
}

type mStockRepositoryMockStockReserve struct {
	optional           bool
	mock               *StockRepositoryMock
	defaultExpectation *StockRepositoryMockStockReserveExpectation
	expectations       []*StockRepositoryMockStockReserveExpectation

	callArgs []*StockRepositoryMockStockReserveParams
	mutex    sync.RWMutex

	expectedInvocations       uint64
	expectedInvocationsOrigin string
}

// StockRepositoryMockStockReserveExpectation specifies expectation struct of the StockRepository.StockReserve
type StockRepositoryMockStockReserveExpectation struct {
	mock               *StockRepositoryMock
	params             *StockRepositoryMockStockReserveParams
	paramPtrs          *StockRepositoryMockStockReserveParamPtrs
	expectationOrigins StockRepositoryMockStockReserveExpectationOrigins
	results            *StockRepositoryMockStockReserveResults
	returnOrigin       string
	Counter            uint64
}

// StockRepositoryMockStockReserveParams contains parameters of the StockRepository.StockReserve
type StockRepositoryMockStockReserveParams struct {
	ctx   context.Context
	stock *entity.Stock
}

// StockRepositoryMockStockReserveParamPtrs contains pointers to parameters of the StockRepository.StockReserve
type StockRepositoryMockStockReserveParamPtrs struct {
	ctx   *context.Context
	stock **entity.Stock
}

// StockRepositoryMockStockReserveResults contains results of the StockRepository.StockReserve
type StockRepositoryMockStockReserveResults struct {
	err error
}

// StockRepositoryMockStockReserveOrigins contains origins of expectations of the StockRepository.StockReserve
type StockRepositoryMockStockReserveExpectationOrigins struct {
	origin      string
	originCtx   string
	originStock 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 (mmStockReserve *mStockRepositoryMockStockReserve) Optional() *mStockRepositoryMockStockReserve {
	mmStockReserve.optional = true
	return mmStockReserve
}

// Expect sets up expected params for StockRepository.StockReserve
func (mmStockReserve *mStockRepositoryMockStockReserve) Expect(ctx context.Context, stock *entity.Stock) *mStockRepositoryMockStockReserve {
	if mmStockReserve.mock.funcStockReserve != nil {
		mmStockReserve.mock.t.Fatalf("StockRepositoryMock.StockReserve mock is already set by Set")
	}

	if mmStockReserve.defaultExpectation == nil {
		mmStockReserve.defaultExpectation = &StockRepositoryMockStockReserveExpectation{}
	}

	if mmStockReserve.defaultExpectation.paramPtrs != nil {
		mmStockReserve.mock.t.Fatalf("StockRepositoryMock.StockReserve mock is already set by ExpectParams functions")
	}

	mmStockReserve.defaultExpectation.params = &StockRepositoryMockStockReserveParams{ctx, stock}
	mmStockReserve.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
	for _, e := range mmStockReserve.expectations {
		if minimock.Equal(e.params, mmStockReserve.defaultExpectation.params) {
			mmStockReserve.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmStockReserve.defaultExpectation.params)
		}
	}

	return mmStockReserve
}

// ExpectCtxParam1 sets up expected param ctx for StockRepository.StockReserve
func (mmStockReserve *mStockRepositoryMockStockReserve) ExpectCtxParam1(ctx context.Context) *mStockRepositoryMockStockReserve {
	if mmStockReserve.mock.funcStockReserve != nil {
		mmStockReserve.mock.t.Fatalf("StockRepositoryMock.StockReserve mock is already set by Set")
	}

	if mmStockReserve.defaultExpectation == nil {
		mmStockReserve.defaultExpectation = &StockRepositoryMockStockReserveExpectation{}
	}

	if mmStockReserve.defaultExpectation.params != nil {
		mmStockReserve.mock.t.Fatalf("StockRepositoryMock.StockReserve mock is already set by Expect")
	}

	if mmStockReserve.defaultExpectation.paramPtrs == nil {
		mmStockReserve.defaultExpectation.paramPtrs = &StockRepositoryMockStockReserveParamPtrs{}
	}
	mmStockReserve.defaultExpectation.paramPtrs.ctx = &ctx
	mmStockReserve.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)

	return mmStockReserve
}

// ExpectStockParam2 sets up expected param stock for StockRepository.StockReserve
func (mmStockReserve *mStockRepositoryMockStockReserve) ExpectStockParam2(stock *entity.Stock) *mStockRepositoryMockStockReserve {
	if mmStockReserve.mock.funcStockReserve != nil {
		mmStockReserve.mock.t.Fatalf("StockRepositoryMock.StockReserve mock is already set by Set")
	}

	if mmStockReserve.defaultExpectation == nil {
		mmStockReserve.defaultExpectation = &StockRepositoryMockStockReserveExpectation{}
	}

	if mmStockReserve.defaultExpectation.params != nil {
		mmStockReserve.mock.t.Fatalf("StockRepositoryMock.StockReserve mock is already set by Expect")
	}

	if mmStockReserve.defaultExpectation.paramPtrs == nil {
		mmStockReserve.defaultExpectation.paramPtrs = &StockRepositoryMockStockReserveParamPtrs{}
	}
	mmStockReserve.defaultExpectation.paramPtrs.stock = &stock
	mmStockReserve.defaultExpectation.expectationOrigins.originStock = minimock.CallerInfo(1)

	return mmStockReserve
}

// Inspect accepts an inspector function that has same arguments as the StockRepository.StockReserve
func (mmStockReserve *mStockRepositoryMockStockReserve) Inspect(f func(ctx context.Context, stock *entity.Stock)) *mStockRepositoryMockStockReserve {
	if mmStockReserve.mock.inspectFuncStockReserve != nil {
		mmStockReserve.mock.t.Fatalf("Inspect function is already set for StockRepositoryMock.StockReserve")
	}

	mmStockReserve.mock.inspectFuncStockReserve = f

	return mmStockReserve
}

// Return sets up results that will be returned by StockRepository.StockReserve
func (mmStockReserve *mStockRepositoryMockStockReserve) Return(err error) *StockRepositoryMock {
	if mmStockReserve.mock.funcStockReserve != nil {
		mmStockReserve.mock.t.Fatalf("StockRepositoryMock.StockReserve mock is already set by Set")
	}

	if mmStockReserve.defaultExpectation == nil {
		mmStockReserve.defaultExpectation = &StockRepositoryMockStockReserveExpectation{mock: mmStockReserve.mock}
	}
	mmStockReserve.defaultExpectation.results = &StockRepositoryMockStockReserveResults{err}
	mmStockReserve.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
	return mmStockReserve.mock
}

// Set uses given function f to mock the StockRepository.StockReserve method
func (mmStockReserve *mStockRepositoryMockStockReserve) Set(f func(ctx context.Context, stock *entity.Stock) (err error)) *StockRepositoryMock {
	if mmStockReserve.defaultExpectation != nil {
		mmStockReserve.mock.t.Fatalf("Default expectation is already set for the StockRepository.StockReserve method")
	}

	if len(mmStockReserve.expectations) > 0 {
		mmStockReserve.mock.t.Fatalf("Some expectations are already set for the StockRepository.StockReserve method")
	}

	mmStockReserve.mock.funcStockReserve = f
	mmStockReserve.mock.funcStockReserveOrigin = minimock.CallerInfo(1)
	return mmStockReserve.mock
}

// When sets expectation for the StockRepository.StockReserve which will trigger the result defined by the following
// Then helper
func (mmStockReserve *mStockRepositoryMockStockReserve) When(ctx context.Context, stock *entity.Stock) *StockRepositoryMockStockReserveExpectation {
	if mmStockReserve.mock.funcStockReserve != nil {
		mmStockReserve.mock.t.Fatalf("StockRepositoryMock.StockReserve mock is already set by Set")
	}

	expectation := &StockRepositoryMockStockReserveExpectation{
		mock:               mmStockReserve.mock,
		params:             &StockRepositoryMockStockReserveParams{ctx, stock},
		expectationOrigins: StockRepositoryMockStockReserveExpectationOrigins{origin: minimock.CallerInfo(1)},
	}
	mmStockReserve.expectations = append(mmStockReserve.expectations, expectation)
	return expectation
}

// Then sets up StockRepository.StockReserve return parameters for the expectation previously defined by the When method
func (e *StockRepositoryMockStockReserveExpectation) Then(err error) *StockRepositoryMock {
	e.results = &StockRepositoryMockStockReserveResults{err}
	return e.mock
}

// Times sets number of times StockRepository.StockReserve should be invoked
func (mmStockReserve *mStockRepositoryMockStockReserve) Times(n uint64) *mStockRepositoryMockStockReserve {
	if n == 0 {
		mmStockReserve.mock.t.Fatalf("Times of StockRepositoryMock.StockReserve mock can not be zero")
	}
	mm_atomic.StoreUint64(&mmStockReserve.expectedInvocations, n)
	mmStockReserve.expectedInvocationsOrigin = minimock.CallerInfo(1)
	return mmStockReserve
}

func (mmStockReserve *mStockRepositoryMockStockReserve) invocationsDone() bool {
	if len(mmStockReserve.expectations) == 0 && mmStockReserve.defaultExpectation == nil && mmStockReserve.mock.funcStockReserve == nil {
		return true
	}

	totalInvocations := mm_atomic.LoadUint64(&mmStockReserve.mock.afterStockReserveCounter)
	expectedInvocations := mm_atomic.LoadUint64(&mmStockReserve.expectedInvocations)

	return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}

// StockReserve implements mm_service.StockRepository
func (mmStockReserve *StockRepositoryMock) StockReserve(ctx context.Context, stock *entity.Stock) (err error) {
	mm_atomic.AddUint64(&mmStockReserve.beforeStockReserveCounter, 1)
	defer mm_atomic.AddUint64(&mmStockReserve.afterStockReserveCounter, 1)

	mmStockReserve.t.Helper()

	if mmStockReserve.inspectFuncStockReserve != nil {
		mmStockReserve.inspectFuncStockReserve(ctx, stock)
	}

	mm_params := StockRepositoryMockStockReserveParams{ctx, stock}

	// Record call args
	mmStockReserve.StockReserveMock.mutex.Lock()
	mmStockReserve.StockReserveMock.callArgs = append(mmStockReserve.StockReserveMock.callArgs, &mm_params)
	mmStockReserve.StockReserveMock.mutex.Unlock()

	for _, e := range mmStockReserve.StockReserveMock.expectations {
		if minimock.Equal(*e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmStockReserve.StockReserveMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmStockReserve.StockReserveMock.defaultExpectation.Counter, 1)
		mm_want := mmStockReserve.StockReserveMock.defaultExpectation.params
		mm_want_ptrs := mmStockReserve.StockReserveMock.defaultExpectation.paramPtrs

		mm_got := StockRepositoryMockStockReserveParams{ctx, stock}

		if mm_want_ptrs != nil {

			if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
				mmStockReserve.t.Errorf("StockRepositoryMock.StockReserve got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
					mmStockReserve.StockReserveMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
			}

			if mm_want_ptrs.stock != nil && !minimock.Equal(*mm_want_ptrs.stock, mm_got.stock) {
				mmStockReserve.t.Errorf("StockRepositoryMock.StockReserve got unexpected parameter stock, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
					mmStockReserve.StockReserveMock.defaultExpectation.expectationOrigins.originStock, *mm_want_ptrs.stock, mm_got.stock, minimock.Diff(*mm_want_ptrs.stock, mm_got.stock))
			}

		} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmStockReserve.t.Errorf("StockRepositoryMock.StockReserve got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
				mmStockReserve.StockReserveMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmStockReserve.StockReserveMock.defaultExpectation.results
		if mm_results == nil {
			mmStockReserve.t.Fatal("No results are set for the StockRepositoryMock.StockReserve")
		}
		return (*mm_results).err
	}
	if mmStockReserve.funcStockReserve != nil {
		return mmStockReserve.funcStockReserve(ctx, stock)
	}
	mmStockReserve.t.Fatalf("Unexpected call to StockRepositoryMock.StockReserve. %v %v", ctx, stock)
	return
}

// StockReserveAfterCounter returns a count of finished StockRepositoryMock.StockReserve invocations
func (mmStockReserve *StockRepositoryMock) StockReserveAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmStockReserve.afterStockReserveCounter)
}

// StockReserveBeforeCounter returns a count of StockRepositoryMock.StockReserve invocations
func (mmStockReserve *StockRepositoryMock) StockReserveBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmStockReserve.beforeStockReserveCounter)
}

// Calls returns a list of arguments used in each call to StockRepositoryMock.StockReserve.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmStockReserve *mStockRepositoryMockStockReserve) Calls() []*StockRepositoryMockStockReserveParams {
	mmStockReserve.mutex.RLock()

	argCopy := make([]*StockRepositoryMockStockReserveParams, len(mmStockReserve.callArgs))
	copy(argCopy, mmStockReserve.callArgs)

	mmStockReserve.mutex.RUnlock()

	return argCopy
}

// MinimockStockReserveDone returns true if the count of the StockReserve invocations corresponds
// the number of defined expectations
func (m *StockRepositoryMock) MinimockStockReserveDone() bool {
	if m.StockReserveMock.optional {
		// Optional methods provide '0 or more' call count restriction.
		return true
	}

	for _, e := range m.StockReserveMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	return m.StockReserveMock.invocationsDone()
}

// MinimockStockReserveInspect logs each unmet expectation
func (m *StockRepositoryMock) MinimockStockReserveInspect() {
	for _, e := range m.StockReserveMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to StockRepositoryMock.StockReserve at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
		}
	}

	afterStockReserveCounter := mm_atomic.LoadUint64(&m.afterStockReserveCounter)
	// if default expectation was set then invocations count should be greater than zero
	if m.StockReserveMock.defaultExpectation != nil && afterStockReserveCounter < 1 {
		if m.StockReserveMock.defaultExpectation.params == nil {
			m.t.Errorf("Expected call to StockRepositoryMock.StockReserve at\n%s", m.StockReserveMock.defaultExpectation.returnOrigin)
		} else {
			m.t.Errorf("Expected call to StockRepositoryMock.StockReserve at\n%s with params: %#v", m.StockReserveMock.defaultExpectation.expectationOrigins.origin, *m.StockReserveMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcStockReserve != nil && afterStockReserveCounter < 1 {
		m.t.Errorf("Expected call to StockRepositoryMock.StockReserve at\n%s", m.funcStockReserveOrigin)
	}

	if !m.StockReserveMock.invocationsDone() && afterStockReserveCounter > 0 {
		m.t.Errorf("Expected %d calls to StockRepositoryMock.StockReserve at\n%s but found %d calls",
			mm_atomic.LoadUint64(&m.StockReserveMock.expectedInvocations), m.StockReserveMock.expectedInvocationsOrigin, afterStockReserveCounter)
	}
}

type mStockRepositoryMockStockReserveRemove struct {
	optional           bool
	mock               *StockRepositoryMock
	defaultExpectation *StockRepositoryMockStockReserveRemoveExpectation
	expectations       []*StockRepositoryMockStockReserveRemoveExpectation

	callArgs []*StockRepositoryMockStockReserveRemoveParams
	mutex    sync.RWMutex

	expectedInvocations       uint64
	expectedInvocationsOrigin string
}

// StockRepositoryMockStockReserveRemoveExpectation specifies expectation struct of the StockRepository.StockReserveRemove
type StockRepositoryMockStockReserveRemoveExpectation struct {
	mock               *StockRepositoryMock
	params             *StockRepositoryMockStockReserveRemoveParams
	paramPtrs          *StockRepositoryMockStockReserveRemoveParamPtrs
	expectationOrigins StockRepositoryMockStockReserveRemoveExpectationOrigins
	results            *StockRepositoryMockStockReserveRemoveResults
	returnOrigin       string
	Counter            uint64
}

// StockRepositoryMockStockReserveRemoveParams contains parameters of the StockRepository.StockReserveRemove
type StockRepositoryMockStockReserveRemoveParams struct {
	ctx   context.Context
	stock *entity.Stock
}

// StockRepositoryMockStockReserveRemoveParamPtrs contains pointers to parameters of the StockRepository.StockReserveRemove
type StockRepositoryMockStockReserveRemoveParamPtrs struct {
	ctx   *context.Context
	stock **entity.Stock
}

// StockRepositoryMockStockReserveRemoveResults contains results of the StockRepository.StockReserveRemove
type StockRepositoryMockStockReserveRemoveResults struct {
	err error
}

// StockRepositoryMockStockReserveRemoveOrigins contains origins of expectations of the StockRepository.StockReserveRemove
type StockRepositoryMockStockReserveRemoveExpectationOrigins struct {
	origin      string
	originCtx   string
	originStock 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 (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) Optional() *mStockRepositoryMockStockReserveRemove {
	mmStockReserveRemove.optional = true
	return mmStockReserveRemove
}

// Expect sets up expected params for StockRepository.StockReserveRemove
func (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) Expect(ctx context.Context, stock *entity.Stock) *mStockRepositoryMockStockReserveRemove {
	if mmStockReserveRemove.mock.funcStockReserveRemove != nil {
		mmStockReserveRemove.mock.t.Fatalf("StockRepositoryMock.StockReserveRemove mock is already set by Set")
	}

	if mmStockReserveRemove.defaultExpectation == nil {
		mmStockReserveRemove.defaultExpectation = &StockRepositoryMockStockReserveRemoveExpectation{}
	}

	if mmStockReserveRemove.defaultExpectation.paramPtrs != nil {
		mmStockReserveRemove.mock.t.Fatalf("StockRepositoryMock.StockReserveRemove mock is already set by ExpectParams functions")
	}

	mmStockReserveRemove.defaultExpectation.params = &StockRepositoryMockStockReserveRemoveParams{ctx, stock}
	mmStockReserveRemove.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
	for _, e := range mmStockReserveRemove.expectations {
		if minimock.Equal(e.params, mmStockReserveRemove.defaultExpectation.params) {
			mmStockReserveRemove.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmStockReserveRemove.defaultExpectation.params)
		}
	}

	return mmStockReserveRemove
}

// ExpectCtxParam1 sets up expected param ctx for StockRepository.StockReserveRemove
func (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) ExpectCtxParam1(ctx context.Context) *mStockRepositoryMockStockReserveRemove {
	if mmStockReserveRemove.mock.funcStockReserveRemove != nil {
		mmStockReserveRemove.mock.t.Fatalf("StockRepositoryMock.StockReserveRemove mock is already set by Set")
	}

	if mmStockReserveRemove.defaultExpectation == nil {
		mmStockReserveRemove.defaultExpectation = &StockRepositoryMockStockReserveRemoveExpectation{}
	}

	if mmStockReserveRemove.defaultExpectation.params != nil {
		mmStockReserveRemove.mock.t.Fatalf("StockRepositoryMock.StockReserveRemove mock is already set by Expect")
	}

	if mmStockReserveRemove.defaultExpectation.paramPtrs == nil {
		mmStockReserveRemove.defaultExpectation.paramPtrs = &StockRepositoryMockStockReserveRemoveParamPtrs{}
	}
	mmStockReserveRemove.defaultExpectation.paramPtrs.ctx = &ctx
	mmStockReserveRemove.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)

	return mmStockReserveRemove
}

// ExpectStockParam2 sets up expected param stock for StockRepository.StockReserveRemove
func (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) ExpectStockParam2(stock *entity.Stock) *mStockRepositoryMockStockReserveRemove {
	if mmStockReserveRemove.mock.funcStockReserveRemove != nil {
		mmStockReserveRemove.mock.t.Fatalf("StockRepositoryMock.StockReserveRemove mock is already set by Set")
	}

	if mmStockReserveRemove.defaultExpectation == nil {
		mmStockReserveRemove.defaultExpectation = &StockRepositoryMockStockReserveRemoveExpectation{}
	}

	if mmStockReserveRemove.defaultExpectation.params != nil {
		mmStockReserveRemove.mock.t.Fatalf("StockRepositoryMock.StockReserveRemove mock is already set by Expect")
	}

	if mmStockReserveRemove.defaultExpectation.paramPtrs == nil {
		mmStockReserveRemove.defaultExpectation.paramPtrs = &StockRepositoryMockStockReserveRemoveParamPtrs{}
	}
	mmStockReserveRemove.defaultExpectation.paramPtrs.stock = &stock
	mmStockReserveRemove.defaultExpectation.expectationOrigins.originStock = minimock.CallerInfo(1)

	return mmStockReserveRemove
}

// Inspect accepts an inspector function that has same arguments as the StockRepository.StockReserveRemove
func (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) Inspect(f func(ctx context.Context, stock *entity.Stock)) *mStockRepositoryMockStockReserveRemove {
	if mmStockReserveRemove.mock.inspectFuncStockReserveRemove != nil {
		mmStockReserveRemove.mock.t.Fatalf("Inspect function is already set for StockRepositoryMock.StockReserveRemove")
	}

	mmStockReserveRemove.mock.inspectFuncStockReserveRemove = f

	return mmStockReserveRemove
}

// Return sets up results that will be returned by StockRepository.StockReserveRemove
func (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) Return(err error) *StockRepositoryMock {
	if mmStockReserveRemove.mock.funcStockReserveRemove != nil {
		mmStockReserveRemove.mock.t.Fatalf("StockRepositoryMock.StockReserveRemove mock is already set by Set")
	}

	if mmStockReserveRemove.defaultExpectation == nil {
		mmStockReserveRemove.defaultExpectation = &StockRepositoryMockStockReserveRemoveExpectation{mock: mmStockReserveRemove.mock}
	}
	mmStockReserveRemove.defaultExpectation.results = &StockRepositoryMockStockReserveRemoveResults{err}
	mmStockReserveRemove.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
	return mmStockReserveRemove.mock
}

// Set uses given function f to mock the StockRepository.StockReserveRemove method
func (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) Set(f func(ctx context.Context, stock *entity.Stock) (err error)) *StockRepositoryMock {
	if mmStockReserveRemove.defaultExpectation != nil {
		mmStockReserveRemove.mock.t.Fatalf("Default expectation is already set for the StockRepository.StockReserveRemove method")
	}

	if len(mmStockReserveRemove.expectations) > 0 {
		mmStockReserveRemove.mock.t.Fatalf("Some expectations are already set for the StockRepository.StockReserveRemove method")
	}

	mmStockReserveRemove.mock.funcStockReserveRemove = f
	mmStockReserveRemove.mock.funcStockReserveRemoveOrigin = minimock.CallerInfo(1)
	return mmStockReserveRemove.mock
}

// When sets expectation for the StockRepository.StockReserveRemove which will trigger the result defined by the following
// Then helper
func (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) When(ctx context.Context, stock *entity.Stock) *StockRepositoryMockStockReserveRemoveExpectation {
	if mmStockReserveRemove.mock.funcStockReserveRemove != nil {
		mmStockReserveRemove.mock.t.Fatalf("StockRepositoryMock.StockReserveRemove mock is already set by Set")
	}

	expectation := &StockRepositoryMockStockReserveRemoveExpectation{
		mock:               mmStockReserveRemove.mock,
		params:             &StockRepositoryMockStockReserveRemoveParams{ctx, stock},
		expectationOrigins: StockRepositoryMockStockReserveRemoveExpectationOrigins{origin: minimock.CallerInfo(1)},
	}
	mmStockReserveRemove.expectations = append(mmStockReserveRemove.expectations, expectation)
	return expectation
}

// Then sets up StockRepository.StockReserveRemove return parameters for the expectation previously defined by the When method
func (e *StockRepositoryMockStockReserveRemoveExpectation) Then(err error) *StockRepositoryMock {
	e.results = &StockRepositoryMockStockReserveRemoveResults{err}
	return e.mock
}

// Times sets number of times StockRepository.StockReserveRemove should be invoked
func (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) Times(n uint64) *mStockRepositoryMockStockReserveRemove {
	if n == 0 {
		mmStockReserveRemove.mock.t.Fatalf("Times of StockRepositoryMock.StockReserveRemove mock can not be zero")
	}
	mm_atomic.StoreUint64(&mmStockReserveRemove.expectedInvocations, n)
	mmStockReserveRemove.expectedInvocationsOrigin = minimock.CallerInfo(1)
	return mmStockReserveRemove
}

func (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) invocationsDone() bool {
	if len(mmStockReserveRemove.expectations) == 0 && mmStockReserveRemove.defaultExpectation == nil && mmStockReserveRemove.mock.funcStockReserveRemove == nil {
		return true
	}

	totalInvocations := mm_atomic.LoadUint64(&mmStockReserveRemove.mock.afterStockReserveRemoveCounter)
	expectedInvocations := mm_atomic.LoadUint64(&mmStockReserveRemove.expectedInvocations)

	return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
}

// StockReserveRemove implements mm_service.StockRepository
func (mmStockReserveRemove *StockRepositoryMock) StockReserveRemove(ctx context.Context, stock *entity.Stock) (err error) {
	mm_atomic.AddUint64(&mmStockReserveRemove.beforeStockReserveRemoveCounter, 1)
	defer mm_atomic.AddUint64(&mmStockReserveRemove.afterStockReserveRemoveCounter, 1)

	mmStockReserveRemove.t.Helper()

	if mmStockReserveRemove.inspectFuncStockReserveRemove != nil {
		mmStockReserveRemove.inspectFuncStockReserveRemove(ctx, stock)
	}

	mm_params := StockRepositoryMockStockReserveRemoveParams{ctx, stock}

	// Record call args
	mmStockReserveRemove.StockReserveRemoveMock.mutex.Lock()
	mmStockReserveRemove.StockReserveRemoveMock.callArgs = append(mmStockReserveRemove.StockReserveRemoveMock.callArgs, &mm_params)
	mmStockReserveRemove.StockReserveRemoveMock.mutex.Unlock()

	for _, e := range mmStockReserveRemove.StockReserveRemoveMock.expectations {
		if minimock.Equal(*e.params, mm_params) {
			mm_atomic.AddUint64(&e.Counter, 1)
			return e.results.err
		}
	}

	if mmStockReserveRemove.StockReserveRemoveMock.defaultExpectation != nil {
		mm_atomic.AddUint64(&mmStockReserveRemove.StockReserveRemoveMock.defaultExpectation.Counter, 1)
		mm_want := mmStockReserveRemove.StockReserveRemoveMock.defaultExpectation.params
		mm_want_ptrs := mmStockReserveRemove.StockReserveRemoveMock.defaultExpectation.paramPtrs

		mm_got := StockRepositoryMockStockReserveRemoveParams{ctx, stock}

		if mm_want_ptrs != nil {

			if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
				mmStockReserveRemove.t.Errorf("StockRepositoryMock.StockReserveRemove got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
					mmStockReserveRemove.StockReserveRemoveMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
			}

			if mm_want_ptrs.stock != nil && !minimock.Equal(*mm_want_ptrs.stock, mm_got.stock) {
				mmStockReserveRemove.t.Errorf("StockRepositoryMock.StockReserveRemove got unexpected parameter stock, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
					mmStockReserveRemove.StockReserveRemoveMock.defaultExpectation.expectationOrigins.originStock, *mm_want_ptrs.stock, mm_got.stock, minimock.Diff(*mm_want_ptrs.stock, mm_got.stock))
			}

		} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
			mmStockReserveRemove.t.Errorf("StockRepositoryMock.StockReserveRemove got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
				mmStockReserveRemove.StockReserveRemoveMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
		}

		mm_results := mmStockReserveRemove.StockReserveRemoveMock.defaultExpectation.results
		if mm_results == nil {
			mmStockReserveRemove.t.Fatal("No results are set for the StockRepositoryMock.StockReserveRemove")
		}
		return (*mm_results).err
	}
	if mmStockReserveRemove.funcStockReserveRemove != nil {
		return mmStockReserveRemove.funcStockReserveRemove(ctx, stock)
	}
	mmStockReserveRemove.t.Fatalf("Unexpected call to StockRepositoryMock.StockReserveRemove. %v %v", ctx, stock)
	return
}

// StockReserveRemoveAfterCounter returns a count of finished StockRepositoryMock.StockReserveRemove invocations
func (mmStockReserveRemove *StockRepositoryMock) StockReserveRemoveAfterCounter() uint64 {
	return mm_atomic.LoadUint64(&mmStockReserveRemove.afterStockReserveRemoveCounter)
}

// StockReserveRemoveBeforeCounter returns a count of StockRepositoryMock.StockReserveRemove invocations
func (mmStockReserveRemove *StockRepositoryMock) StockReserveRemoveBeforeCounter() uint64 {
	return mm_atomic.LoadUint64(&mmStockReserveRemove.beforeStockReserveRemoveCounter)
}

// Calls returns a list of arguments used in each call to StockRepositoryMock.StockReserveRemove.
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
func (mmStockReserveRemove *mStockRepositoryMockStockReserveRemove) Calls() []*StockRepositoryMockStockReserveRemoveParams {
	mmStockReserveRemove.mutex.RLock()

	argCopy := make([]*StockRepositoryMockStockReserveRemoveParams, len(mmStockReserveRemove.callArgs))
	copy(argCopy, mmStockReserveRemove.callArgs)

	mmStockReserveRemove.mutex.RUnlock()

	return argCopy
}

// MinimockStockReserveRemoveDone returns true if the count of the StockReserveRemove invocations corresponds
// the number of defined expectations
func (m *StockRepositoryMock) MinimockStockReserveRemoveDone() bool {
	if m.StockReserveRemoveMock.optional {
		// Optional methods provide '0 or more' call count restriction.
		return true
	}

	for _, e := range m.StockReserveRemoveMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			return false
		}
	}

	return m.StockReserveRemoveMock.invocationsDone()
}

// MinimockStockReserveRemoveInspect logs each unmet expectation
func (m *StockRepositoryMock) MinimockStockReserveRemoveInspect() {
	for _, e := range m.StockReserveRemoveMock.expectations {
		if mm_atomic.LoadUint64(&e.Counter) < 1 {
			m.t.Errorf("Expected call to StockRepositoryMock.StockReserveRemove at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
		}
	}

	afterStockReserveRemoveCounter := mm_atomic.LoadUint64(&m.afterStockReserveRemoveCounter)
	// if default expectation was set then invocations count should be greater than zero
	if m.StockReserveRemoveMock.defaultExpectation != nil && afterStockReserveRemoveCounter < 1 {
		if m.StockReserveRemoveMock.defaultExpectation.params == nil {
			m.t.Errorf("Expected call to StockRepositoryMock.StockReserveRemove at\n%s", m.StockReserveRemoveMock.defaultExpectation.returnOrigin)
		} else {
			m.t.Errorf("Expected call to StockRepositoryMock.StockReserveRemove at\n%s with params: %#v", m.StockReserveRemoveMock.defaultExpectation.expectationOrigins.origin, *m.StockReserveRemoveMock.defaultExpectation.params)
		}
	}
	// if func was set then invocations count should be greater than zero
	if m.funcStockReserveRemove != nil && afterStockReserveRemoveCounter < 1 {
		m.t.Errorf("Expected call to StockRepositoryMock.StockReserveRemove at\n%s", m.funcStockReserveRemoveOrigin)
	}

	if !m.StockReserveRemoveMock.invocationsDone() && afterStockReserveRemoveCounter > 0 {
		m.t.Errorf("Expected %d calls to StockRepositoryMock.StockReserveRemove at\n%s but found %d calls",
			mm_atomic.LoadUint64(&m.StockReserveRemoveMock.expectedInvocations), m.StockReserveRemoveMock.expectedInvocationsOrigin, afterStockReserveRemoveCounter)
	}
}

// MinimockFinish checks that all mocked methods have been called the expected number of times
func (m *StockRepositoryMock) MinimockFinish() {
	m.finishOnce.Do(func() {
		if !m.minimockDone() {
			m.MinimockStockCancelInspect()

			m.MinimockStockGetByIDInspect()

			m.MinimockStockReserveInspect()

			m.MinimockStockReserveRemoveInspect()
		}
	})
}

// MinimockWait waits for all mocked methods to be called the expected number of times
func (m *StockRepositoryMock) 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 *StockRepositoryMock) minimockDone() bool {
	done := true
	return done &&
		m.MinimockStockCancelDone() &&
		m.MinimockStockGetByIDDone() &&
		m.MinimockStockReserveDone() &&
		m.MinimockStockReserveRemoveDone()
}
