1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419 |
- // Code generated by http://github.com/gojuno/minimock (v3.3.13). DO NOT EDIT.
- package mocks
- //go:generate minimock -i git.dmitriygnatenko.ru/dima/homethings/internal/api/v1/image.ThingImageRepository -o thing_image_repository_minimock.go -n ThingImageRepositoryMock -p mocks
- import (
- "context"
- "database/sql"
- "sync"
- mm_atomic "sync/atomic"
- mm_time "time"
- "git.dmitriygnatenko.ru/dima/homethings/internal/models"
- "github.com/gojuno/minimock/v3"
- )
- // ThingImageRepositoryMock implements image.ThingImageRepository
- type ThingImageRepositoryMock struct {
- t minimock.Tester
- finishOnce sync.Once
- funcAdd func(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx) (err error)
- inspectFuncAdd func(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx)
- afterAddCounter uint64
- beforeAddCounter uint64
- AddMock mThingImageRepositoryMockAdd
- funcBeginTx func(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error)
- inspectFuncBeginTx func(ctx context.Context, level sql.IsolationLevel)
- afterBeginTxCounter uint64
- beforeBeginTxCounter uint64
- BeginTxMock mThingImageRepositoryMockBeginTx
- funcCommitTx func(tx *sql.Tx) (err error)
- inspectFuncCommitTx func(tx *sql.Tx)
- afterCommitTxCounter uint64
- beforeCommitTxCounter uint64
- CommitTxMock mThingImageRepositoryMockCommitTx
- funcDelete func(ctx context.Context, imageID int, tx *sql.Tx) (err error)
- inspectFuncDelete func(ctx context.Context, imageID int, tx *sql.Tx)
- afterDeleteCounter uint64
- beforeDeleteCounter uint64
- DeleteMock mThingImageRepositoryMockDelete
- funcGet func(ctx context.Context, imageID int) (ip1 *models.Image, err error)
- inspectFuncGet func(ctx context.Context, imageID int)
- afterGetCounter uint64
- beforeGetCounter uint64
- GetMock mThingImageRepositoryMockGet
- funcGetByPlaceID func(ctx context.Context, placeID int) (ia1 []models.Image, err error)
- inspectFuncGetByPlaceID func(ctx context.Context, placeID int)
- afterGetByPlaceIDCounter uint64
- beforeGetByPlaceIDCounter uint64
- GetByPlaceIDMock mThingImageRepositoryMockGetByPlaceID
- funcGetByThingID func(ctx context.Context, thingID int) (ia1 []models.Image, err error)
- inspectFuncGetByThingID func(ctx context.Context, thingID int)
- afterGetByThingIDCounter uint64
- beforeGetByThingIDCounter uint64
- GetByThingIDMock mThingImageRepositoryMockGetByThingID
- }
- // NewThingImageRepositoryMock returns a mock for image.ThingImageRepository
- func NewThingImageRepositoryMock(t minimock.Tester) *ThingImageRepositoryMock {
- m := &ThingImageRepositoryMock{t: t}
- if controller, ok := t.(minimock.MockController); ok {
- controller.RegisterMocker(m)
- }
- m.AddMock = mThingImageRepositoryMockAdd{mock: m}
- m.AddMock.callArgs = []*ThingImageRepositoryMockAddParams{}
- m.BeginTxMock = mThingImageRepositoryMockBeginTx{mock: m}
- m.BeginTxMock.callArgs = []*ThingImageRepositoryMockBeginTxParams{}
- m.CommitTxMock = mThingImageRepositoryMockCommitTx{mock: m}
- m.CommitTxMock.callArgs = []*ThingImageRepositoryMockCommitTxParams{}
- m.DeleteMock = mThingImageRepositoryMockDelete{mock: m}
- m.DeleteMock.callArgs = []*ThingImageRepositoryMockDeleteParams{}
- m.GetMock = mThingImageRepositoryMockGet{mock: m}
- m.GetMock.callArgs = []*ThingImageRepositoryMockGetParams{}
- m.GetByPlaceIDMock = mThingImageRepositoryMockGetByPlaceID{mock: m}
- m.GetByPlaceIDMock.callArgs = []*ThingImageRepositoryMockGetByPlaceIDParams{}
- m.GetByThingIDMock = mThingImageRepositoryMockGetByThingID{mock: m}
- m.GetByThingIDMock.callArgs = []*ThingImageRepositoryMockGetByThingIDParams{}
- t.Cleanup(m.MinimockFinish)
- return m
- }
- type mThingImageRepositoryMockAdd struct {
- optional bool
- mock *ThingImageRepositoryMock
- defaultExpectation *ThingImageRepositoryMockAddExpectation
- expectations []*ThingImageRepositoryMockAddExpectation
- callArgs []*ThingImageRepositoryMockAddParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // ThingImageRepositoryMockAddExpectation specifies expectation struct of the ThingImageRepository.Add
- type ThingImageRepositoryMockAddExpectation struct {
- mock *ThingImageRepositoryMock
- params *ThingImageRepositoryMockAddParams
- paramPtrs *ThingImageRepositoryMockAddParamPtrs
- results *ThingImageRepositoryMockAddResults
- Counter uint64
- }
- // ThingImageRepositoryMockAddParams contains parameters of the ThingImageRepository.Add
- type ThingImageRepositoryMockAddParams struct {
- ctx context.Context
- req models.AddThingImageRequest
- tx *sql.Tx
- }
- // ThingImageRepositoryMockAddParamPtrs contains pointers to parameters of the ThingImageRepository.Add
- type ThingImageRepositoryMockAddParamPtrs struct {
- ctx *context.Context
- req *models.AddThingImageRequest
- tx **sql.Tx
- }
- // ThingImageRepositoryMockAddResults contains results of the ThingImageRepository.Add
- type ThingImageRepositoryMockAddResults struct {
- err error
- }
- // 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 (mmAdd *mThingImageRepositoryMockAdd) Optional() *mThingImageRepositoryMockAdd {
- mmAdd.optional = true
- return mmAdd
- }
- // Expect sets up expected params for ThingImageRepository.Add
- func (mmAdd *mThingImageRepositoryMockAdd) Expect(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx) *mThingImageRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &ThingImageRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.paramPtrs != nil {
- mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by ExpectParams functions")
- }
- mmAdd.defaultExpectation.params = &ThingImageRepositoryMockAddParams{ctx, req, tx}
- for _, e := range mmAdd.expectations {
- if minimock.Equal(e.params, mmAdd.defaultExpectation.params) {
- mmAdd.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmAdd.defaultExpectation.params)
- }
- }
- return mmAdd
- }
- // ExpectCtxParam1 sets up expected param ctx for ThingImageRepository.Add
- func (mmAdd *mThingImageRepositoryMockAdd) ExpectCtxParam1(ctx context.Context) *mThingImageRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &ThingImageRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.params != nil {
- mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Expect")
- }
- if mmAdd.defaultExpectation.paramPtrs == nil {
- mmAdd.defaultExpectation.paramPtrs = &ThingImageRepositoryMockAddParamPtrs{}
- }
- mmAdd.defaultExpectation.paramPtrs.ctx = &ctx
- return mmAdd
- }
- // ExpectReqParam2 sets up expected param req for ThingImageRepository.Add
- func (mmAdd *mThingImageRepositoryMockAdd) ExpectReqParam2(req models.AddThingImageRequest) *mThingImageRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &ThingImageRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.params != nil {
- mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Expect")
- }
- if mmAdd.defaultExpectation.paramPtrs == nil {
- mmAdd.defaultExpectation.paramPtrs = &ThingImageRepositoryMockAddParamPtrs{}
- }
- mmAdd.defaultExpectation.paramPtrs.req = &req
- return mmAdd
- }
- // ExpectTxParam3 sets up expected param tx for ThingImageRepository.Add
- func (mmAdd *mThingImageRepositoryMockAdd) ExpectTxParam3(tx *sql.Tx) *mThingImageRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &ThingImageRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.params != nil {
- mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Expect")
- }
- if mmAdd.defaultExpectation.paramPtrs == nil {
- mmAdd.defaultExpectation.paramPtrs = &ThingImageRepositoryMockAddParamPtrs{}
- }
- mmAdd.defaultExpectation.paramPtrs.tx = &tx
- return mmAdd
- }
- // Inspect accepts an inspector function that has same arguments as the ThingImageRepository.Add
- func (mmAdd *mThingImageRepositoryMockAdd) Inspect(f func(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx)) *mThingImageRepositoryMockAdd {
- if mmAdd.mock.inspectFuncAdd != nil {
- mmAdd.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.Add")
- }
- mmAdd.mock.inspectFuncAdd = f
- return mmAdd
- }
- // Return sets up results that will be returned by ThingImageRepository.Add
- func (mmAdd *mThingImageRepositoryMockAdd) Return(err error) *ThingImageRepositoryMock {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &ThingImageRepositoryMockAddExpectation{mock: mmAdd.mock}
- }
- mmAdd.defaultExpectation.results = &ThingImageRepositoryMockAddResults{err}
- return mmAdd.mock
- }
- // Set uses given function f to mock the ThingImageRepository.Add method
- func (mmAdd *mThingImageRepositoryMockAdd) Set(f func(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx) (err error)) *ThingImageRepositoryMock {
- if mmAdd.defaultExpectation != nil {
- mmAdd.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.Add method")
- }
- if len(mmAdd.expectations) > 0 {
- mmAdd.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.Add method")
- }
- mmAdd.mock.funcAdd = f
- return mmAdd.mock
- }
- // When sets expectation for the ThingImageRepository.Add which will trigger the result defined by the following
- // Then helper
- func (mmAdd *mThingImageRepositoryMockAdd) When(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx) *ThingImageRepositoryMockAddExpectation {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("ThingImageRepositoryMock.Add mock is already set by Set")
- }
- expectation := &ThingImageRepositoryMockAddExpectation{
- mock: mmAdd.mock,
- params: &ThingImageRepositoryMockAddParams{ctx, req, tx},
- }
- mmAdd.expectations = append(mmAdd.expectations, expectation)
- return expectation
- }
- // Then sets up ThingImageRepository.Add return parameters for the expectation previously defined by the When method
- func (e *ThingImageRepositoryMockAddExpectation) Then(err error) *ThingImageRepositoryMock {
- e.results = &ThingImageRepositoryMockAddResults{err}
- return e.mock
- }
- // Times sets number of times ThingImageRepository.Add should be invoked
- func (mmAdd *mThingImageRepositoryMockAdd) Times(n uint64) *mThingImageRepositoryMockAdd {
- if n == 0 {
- mmAdd.mock.t.Fatalf("Times of ThingImageRepositoryMock.Add mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmAdd.expectedInvocations, n)
- return mmAdd
- }
- func (mmAdd *mThingImageRepositoryMockAdd) invocationsDone() bool {
- if len(mmAdd.expectations) == 0 && mmAdd.defaultExpectation == nil && mmAdd.mock.funcAdd == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmAdd.mock.afterAddCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmAdd.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // Add implements image.ThingImageRepository
- func (mmAdd *ThingImageRepositoryMock) Add(ctx context.Context, req models.AddThingImageRequest, tx *sql.Tx) (err error) {
- mm_atomic.AddUint64(&mmAdd.beforeAddCounter, 1)
- defer mm_atomic.AddUint64(&mmAdd.afterAddCounter, 1)
- if mmAdd.inspectFuncAdd != nil {
- mmAdd.inspectFuncAdd(ctx, req, tx)
- }
- mm_params := ThingImageRepositoryMockAddParams{ctx, req, tx}
- // Record call args
- mmAdd.AddMock.mutex.Lock()
- mmAdd.AddMock.callArgs = append(mmAdd.AddMock.callArgs, &mm_params)
- mmAdd.AddMock.mutex.Unlock()
- for _, e := range mmAdd.AddMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.err
- }
- }
- if mmAdd.AddMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmAdd.AddMock.defaultExpectation.Counter, 1)
- mm_want := mmAdd.AddMock.defaultExpectation.params
- mm_want_ptrs := mmAdd.AddMock.defaultExpectation.paramPtrs
- mm_got := ThingImageRepositoryMockAddParams{ctx, req, tx}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmAdd.t.Errorf("ThingImageRepositoryMock.Add got unexpected parameter ctx, want: %#v, got: %#v%s\n", *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) {
- mmAdd.t.Errorf("ThingImageRepositoryMock.Add got unexpected parameter req, want: %#v, got: %#v%s\n", *mm_want_ptrs.req, mm_got.req, minimock.Diff(*mm_want_ptrs.req, mm_got.req))
- }
- if mm_want_ptrs.tx != nil && !minimock.Equal(*mm_want_ptrs.tx, mm_got.tx) {
- mmAdd.t.Errorf("ThingImageRepositoryMock.Add got unexpected parameter tx, want: %#v, got: %#v%s\n", *mm_want_ptrs.tx, mm_got.tx, minimock.Diff(*mm_want_ptrs.tx, mm_got.tx))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmAdd.t.Errorf("ThingImageRepositoryMock.Add got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmAdd.AddMock.defaultExpectation.results
- if mm_results == nil {
- mmAdd.t.Fatal("No results are set for the ThingImageRepositoryMock.Add")
- }
- return (*mm_results).err
- }
- if mmAdd.funcAdd != nil {
- return mmAdd.funcAdd(ctx, req, tx)
- }
- mmAdd.t.Fatalf("Unexpected call to ThingImageRepositoryMock.Add. %v %v %v", ctx, req, tx)
- return
- }
- // AddAfterCounter returns a count of finished ThingImageRepositoryMock.Add invocations
- func (mmAdd *ThingImageRepositoryMock) AddAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
- }
- // AddBeforeCounter returns a count of ThingImageRepositoryMock.Add invocations
- func (mmAdd *ThingImageRepositoryMock) AddBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
- }
- // Calls returns a list of arguments used in each call to ThingImageRepositoryMock.Add.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmAdd *mThingImageRepositoryMockAdd) Calls() []*ThingImageRepositoryMockAddParams {
- mmAdd.mutex.RLock()
- argCopy := make([]*ThingImageRepositoryMockAddParams, len(mmAdd.callArgs))
- copy(argCopy, mmAdd.callArgs)
- mmAdd.mutex.RUnlock()
- return argCopy
- }
- // MinimockAddDone returns true if the count of the Add invocations corresponds
- // the number of defined expectations
- func (m *ThingImageRepositoryMock) MinimockAddDone() bool {
- if m.AddMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.AddMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.AddMock.invocationsDone()
- }
- // MinimockAddInspect logs each unmet expectation
- func (m *ThingImageRepositoryMock) MinimockAddInspect() {
- for _, e := range m.AddMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.Add with params: %#v", *e.params)
- }
- }
- afterAddCounter := mm_atomic.LoadUint64(&m.afterAddCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.AddMock.defaultExpectation != nil && afterAddCounter < 1 {
- if m.AddMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to ThingImageRepositoryMock.Add")
- } else {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.Add with params: %#v", *m.AddMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcAdd != nil && afterAddCounter < 1 {
- m.t.Error("Expected call to ThingImageRepositoryMock.Add")
- }
- if !m.AddMock.invocationsDone() && afterAddCounter > 0 {
- m.t.Errorf("Expected %d calls to ThingImageRepositoryMock.Add but found %d calls",
- mm_atomic.LoadUint64(&m.AddMock.expectedInvocations), afterAddCounter)
- }
- }
- type mThingImageRepositoryMockBeginTx struct {
- optional bool
- mock *ThingImageRepositoryMock
- defaultExpectation *ThingImageRepositoryMockBeginTxExpectation
- expectations []*ThingImageRepositoryMockBeginTxExpectation
- callArgs []*ThingImageRepositoryMockBeginTxParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // ThingImageRepositoryMockBeginTxExpectation specifies expectation struct of the ThingImageRepository.BeginTx
- type ThingImageRepositoryMockBeginTxExpectation struct {
- mock *ThingImageRepositoryMock
- params *ThingImageRepositoryMockBeginTxParams
- paramPtrs *ThingImageRepositoryMockBeginTxParamPtrs
- results *ThingImageRepositoryMockBeginTxResults
- Counter uint64
- }
- // ThingImageRepositoryMockBeginTxParams contains parameters of the ThingImageRepository.BeginTx
- type ThingImageRepositoryMockBeginTxParams struct {
- ctx context.Context
- level sql.IsolationLevel
- }
- // ThingImageRepositoryMockBeginTxParamPtrs contains pointers to parameters of the ThingImageRepository.BeginTx
- type ThingImageRepositoryMockBeginTxParamPtrs struct {
- ctx *context.Context
- level *sql.IsolationLevel
- }
- // ThingImageRepositoryMockBeginTxResults contains results of the ThingImageRepository.BeginTx
- type ThingImageRepositoryMockBeginTxResults struct {
- tp1 *sql.Tx
- err error
- }
- // 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 (mmBeginTx *mThingImageRepositoryMockBeginTx) Optional() *mThingImageRepositoryMockBeginTx {
- mmBeginTx.optional = true
- return mmBeginTx
- }
- // Expect sets up expected params for ThingImageRepository.BeginTx
- func (mmBeginTx *mThingImageRepositoryMockBeginTx) Expect(ctx context.Context, level sql.IsolationLevel) *mThingImageRepositoryMockBeginTx {
- if mmBeginTx.mock.funcBeginTx != nil {
- mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by Set")
- }
- if mmBeginTx.defaultExpectation == nil {
- mmBeginTx.defaultExpectation = &ThingImageRepositoryMockBeginTxExpectation{}
- }
- if mmBeginTx.defaultExpectation.paramPtrs != nil {
- mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by ExpectParams functions")
- }
- mmBeginTx.defaultExpectation.params = &ThingImageRepositoryMockBeginTxParams{ctx, level}
- for _, e := range mmBeginTx.expectations {
- if minimock.Equal(e.params, mmBeginTx.defaultExpectation.params) {
- mmBeginTx.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmBeginTx.defaultExpectation.params)
- }
- }
- return mmBeginTx
- }
- // ExpectCtxParam1 sets up expected param ctx for ThingImageRepository.BeginTx
- func (mmBeginTx *mThingImageRepositoryMockBeginTx) ExpectCtxParam1(ctx context.Context) *mThingImageRepositoryMockBeginTx {
- if mmBeginTx.mock.funcBeginTx != nil {
- mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by Set")
- }
- if mmBeginTx.defaultExpectation == nil {
- mmBeginTx.defaultExpectation = &ThingImageRepositoryMockBeginTxExpectation{}
- }
- if mmBeginTx.defaultExpectation.params != nil {
- mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by Expect")
- }
- if mmBeginTx.defaultExpectation.paramPtrs == nil {
- mmBeginTx.defaultExpectation.paramPtrs = &ThingImageRepositoryMockBeginTxParamPtrs{}
- }
- mmBeginTx.defaultExpectation.paramPtrs.ctx = &ctx
- return mmBeginTx
- }
- // ExpectLevelParam2 sets up expected param level for ThingImageRepository.BeginTx
- func (mmBeginTx *mThingImageRepositoryMockBeginTx) ExpectLevelParam2(level sql.IsolationLevel) *mThingImageRepositoryMockBeginTx {
- if mmBeginTx.mock.funcBeginTx != nil {
- mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by Set")
- }
- if mmBeginTx.defaultExpectation == nil {
- mmBeginTx.defaultExpectation = &ThingImageRepositoryMockBeginTxExpectation{}
- }
- if mmBeginTx.defaultExpectation.params != nil {
- mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by Expect")
- }
- if mmBeginTx.defaultExpectation.paramPtrs == nil {
- mmBeginTx.defaultExpectation.paramPtrs = &ThingImageRepositoryMockBeginTxParamPtrs{}
- }
- mmBeginTx.defaultExpectation.paramPtrs.level = &level
- return mmBeginTx
- }
- // Inspect accepts an inspector function that has same arguments as the ThingImageRepository.BeginTx
- func (mmBeginTx *mThingImageRepositoryMockBeginTx) Inspect(f func(ctx context.Context, level sql.IsolationLevel)) *mThingImageRepositoryMockBeginTx {
- if mmBeginTx.mock.inspectFuncBeginTx != nil {
- mmBeginTx.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.BeginTx")
- }
- mmBeginTx.mock.inspectFuncBeginTx = f
- return mmBeginTx
- }
- // Return sets up results that will be returned by ThingImageRepository.BeginTx
- func (mmBeginTx *mThingImageRepositoryMockBeginTx) Return(tp1 *sql.Tx, err error) *ThingImageRepositoryMock {
- if mmBeginTx.mock.funcBeginTx != nil {
- mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by Set")
- }
- if mmBeginTx.defaultExpectation == nil {
- mmBeginTx.defaultExpectation = &ThingImageRepositoryMockBeginTxExpectation{mock: mmBeginTx.mock}
- }
- mmBeginTx.defaultExpectation.results = &ThingImageRepositoryMockBeginTxResults{tp1, err}
- return mmBeginTx.mock
- }
- // Set uses given function f to mock the ThingImageRepository.BeginTx method
- func (mmBeginTx *mThingImageRepositoryMockBeginTx) Set(f func(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error)) *ThingImageRepositoryMock {
- if mmBeginTx.defaultExpectation != nil {
- mmBeginTx.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.BeginTx method")
- }
- if len(mmBeginTx.expectations) > 0 {
- mmBeginTx.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.BeginTx method")
- }
- mmBeginTx.mock.funcBeginTx = f
- return mmBeginTx.mock
- }
- // When sets expectation for the ThingImageRepository.BeginTx which will trigger the result defined by the following
- // Then helper
- func (mmBeginTx *mThingImageRepositoryMockBeginTx) When(ctx context.Context, level sql.IsolationLevel) *ThingImageRepositoryMockBeginTxExpectation {
- if mmBeginTx.mock.funcBeginTx != nil {
- mmBeginTx.mock.t.Fatalf("ThingImageRepositoryMock.BeginTx mock is already set by Set")
- }
- expectation := &ThingImageRepositoryMockBeginTxExpectation{
- mock: mmBeginTx.mock,
- params: &ThingImageRepositoryMockBeginTxParams{ctx, level},
- }
- mmBeginTx.expectations = append(mmBeginTx.expectations, expectation)
- return expectation
- }
- // Then sets up ThingImageRepository.BeginTx return parameters for the expectation previously defined by the When method
- func (e *ThingImageRepositoryMockBeginTxExpectation) Then(tp1 *sql.Tx, err error) *ThingImageRepositoryMock {
- e.results = &ThingImageRepositoryMockBeginTxResults{tp1, err}
- return e.mock
- }
- // Times sets number of times ThingImageRepository.BeginTx should be invoked
- func (mmBeginTx *mThingImageRepositoryMockBeginTx) Times(n uint64) *mThingImageRepositoryMockBeginTx {
- if n == 0 {
- mmBeginTx.mock.t.Fatalf("Times of ThingImageRepositoryMock.BeginTx mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmBeginTx.expectedInvocations, n)
- return mmBeginTx
- }
- func (mmBeginTx *mThingImageRepositoryMockBeginTx) invocationsDone() bool {
- if len(mmBeginTx.expectations) == 0 && mmBeginTx.defaultExpectation == nil && mmBeginTx.mock.funcBeginTx == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmBeginTx.mock.afterBeginTxCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmBeginTx.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // BeginTx implements image.ThingImageRepository
- func (mmBeginTx *ThingImageRepositoryMock) BeginTx(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error) {
- mm_atomic.AddUint64(&mmBeginTx.beforeBeginTxCounter, 1)
- defer mm_atomic.AddUint64(&mmBeginTx.afterBeginTxCounter, 1)
- if mmBeginTx.inspectFuncBeginTx != nil {
- mmBeginTx.inspectFuncBeginTx(ctx, level)
- }
- mm_params := ThingImageRepositoryMockBeginTxParams{ctx, level}
- // Record call args
- mmBeginTx.BeginTxMock.mutex.Lock()
- mmBeginTx.BeginTxMock.callArgs = append(mmBeginTx.BeginTxMock.callArgs, &mm_params)
- mmBeginTx.BeginTxMock.mutex.Unlock()
- for _, e := range mmBeginTx.BeginTxMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.tp1, e.results.err
- }
- }
- if mmBeginTx.BeginTxMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmBeginTx.BeginTxMock.defaultExpectation.Counter, 1)
- mm_want := mmBeginTx.BeginTxMock.defaultExpectation.params
- mm_want_ptrs := mmBeginTx.BeginTxMock.defaultExpectation.paramPtrs
- mm_got := ThingImageRepositoryMockBeginTxParams{ctx, level}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmBeginTx.t.Errorf("ThingImageRepositoryMock.BeginTx got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
- }
- if mm_want_ptrs.level != nil && !minimock.Equal(*mm_want_ptrs.level, mm_got.level) {
- mmBeginTx.t.Errorf("ThingImageRepositoryMock.BeginTx got unexpected parameter level, want: %#v, got: %#v%s\n", *mm_want_ptrs.level, mm_got.level, minimock.Diff(*mm_want_ptrs.level, mm_got.level))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmBeginTx.t.Errorf("ThingImageRepositoryMock.BeginTx got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmBeginTx.BeginTxMock.defaultExpectation.results
- if mm_results == nil {
- mmBeginTx.t.Fatal("No results are set for the ThingImageRepositoryMock.BeginTx")
- }
- return (*mm_results).tp1, (*mm_results).err
- }
- if mmBeginTx.funcBeginTx != nil {
- return mmBeginTx.funcBeginTx(ctx, level)
- }
- mmBeginTx.t.Fatalf("Unexpected call to ThingImageRepositoryMock.BeginTx. %v %v", ctx, level)
- return
- }
- // BeginTxAfterCounter returns a count of finished ThingImageRepositoryMock.BeginTx invocations
- func (mmBeginTx *ThingImageRepositoryMock) BeginTxAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmBeginTx.afterBeginTxCounter)
- }
- // BeginTxBeforeCounter returns a count of ThingImageRepositoryMock.BeginTx invocations
- func (mmBeginTx *ThingImageRepositoryMock) BeginTxBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmBeginTx.beforeBeginTxCounter)
- }
- // Calls returns a list of arguments used in each call to ThingImageRepositoryMock.BeginTx.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmBeginTx *mThingImageRepositoryMockBeginTx) Calls() []*ThingImageRepositoryMockBeginTxParams {
- mmBeginTx.mutex.RLock()
- argCopy := make([]*ThingImageRepositoryMockBeginTxParams, len(mmBeginTx.callArgs))
- copy(argCopy, mmBeginTx.callArgs)
- mmBeginTx.mutex.RUnlock()
- return argCopy
- }
- // MinimockBeginTxDone returns true if the count of the BeginTx invocations corresponds
- // the number of defined expectations
- func (m *ThingImageRepositoryMock) MinimockBeginTxDone() bool {
- if m.BeginTxMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.BeginTxMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.BeginTxMock.invocationsDone()
- }
- // MinimockBeginTxInspect logs each unmet expectation
- func (m *ThingImageRepositoryMock) MinimockBeginTxInspect() {
- for _, e := range m.BeginTxMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.BeginTx with params: %#v", *e.params)
- }
- }
- afterBeginTxCounter := mm_atomic.LoadUint64(&m.afterBeginTxCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.BeginTxMock.defaultExpectation != nil && afterBeginTxCounter < 1 {
- if m.BeginTxMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to ThingImageRepositoryMock.BeginTx")
- } else {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.BeginTx with params: %#v", *m.BeginTxMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcBeginTx != nil && afterBeginTxCounter < 1 {
- m.t.Error("Expected call to ThingImageRepositoryMock.BeginTx")
- }
- if !m.BeginTxMock.invocationsDone() && afterBeginTxCounter > 0 {
- m.t.Errorf("Expected %d calls to ThingImageRepositoryMock.BeginTx but found %d calls",
- mm_atomic.LoadUint64(&m.BeginTxMock.expectedInvocations), afterBeginTxCounter)
- }
- }
- type mThingImageRepositoryMockCommitTx struct {
- optional bool
- mock *ThingImageRepositoryMock
- defaultExpectation *ThingImageRepositoryMockCommitTxExpectation
- expectations []*ThingImageRepositoryMockCommitTxExpectation
- callArgs []*ThingImageRepositoryMockCommitTxParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // ThingImageRepositoryMockCommitTxExpectation specifies expectation struct of the ThingImageRepository.CommitTx
- type ThingImageRepositoryMockCommitTxExpectation struct {
- mock *ThingImageRepositoryMock
- params *ThingImageRepositoryMockCommitTxParams
- paramPtrs *ThingImageRepositoryMockCommitTxParamPtrs
- results *ThingImageRepositoryMockCommitTxResults
- Counter uint64
- }
- // ThingImageRepositoryMockCommitTxParams contains parameters of the ThingImageRepository.CommitTx
- type ThingImageRepositoryMockCommitTxParams struct {
- tx *sql.Tx
- }
- // ThingImageRepositoryMockCommitTxParamPtrs contains pointers to parameters of the ThingImageRepository.CommitTx
- type ThingImageRepositoryMockCommitTxParamPtrs struct {
- tx **sql.Tx
- }
- // ThingImageRepositoryMockCommitTxResults contains results of the ThingImageRepository.CommitTx
- type ThingImageRepositoryMockCommitTxResults struct {
- err error
- }
- // 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 (mmCommitTx *mThingImageRepositoryMockCommitTx) Optional() *mThingImageRepositoryMockCommitTx {
- mmCommitTx.optional = true
- return mmCommitTx
- }
- // Expect sets up expected params for ThingImageRepository.CommitTx
- func (mmCommitTx *mThingImageRepositoryMockCommitTx) Expect(tx *sql.Tx) *mThingImageRepositoryMockCommitTx {
- if mmCommitTx.mock.funcCommitTx != nil {
- mmCommitTx.mock.t.Fatalf("ThingImageRepositoryMock.CommitTx mock is already set by Set")
- }
- if mmCommitTx.defaultExpectation == nil {
- mmCommitTx.defaultExpectation = &ThingImageRepositoryMockCommitTxExpectation{}
- }
- if mmCommitTx.defaultExpectation.paramPtrs != nil {
- mmCommitTx.mock.t.Fatalf("ThingImageRepositoryMock.CommitTx mock is already set by ExpectParams functions")
- }
- mmCommitTx.defaultExpectation.params = &ThingImageRepositoryMockCommitTxParams{tx}
- for _, e := range mmCommitTx.expectations {
- if minimock.Equal(e.params, mmCommitTx.defaultExpectation.params) {
- mmCommitTx.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCommitTx.defaultExpectation.params)
- }
- }
- return mmCommitTx
- }
- // ExpectTxParam1 sets up expected param tx for ThingImageRepository.CommitTx
- func (mmCommitTx *mThingImageRepositoryMockCommitTx) ExpectTxParam1(tx *sql.Tx) *mThingImageRepositoryMockCommitTx {
- if mmCommitTx.mock.funcCommitTx != nil {
- mmCommitTx.mock.t.Fatalf("ThingImageRepositoryMock.CommitTx mock is already set by Set")
- }
- if mmCommitTx.defaultExpectation == nil {
- mmCommitTx.defaultExpectation = &ThingImageRepositoryMockCommitTxExpectation{}
- }
- if mmCommitTx.defaultExpectation.params != nil {
- mmCommitTx.mock.t.Fatalf("ThingImageRepositoryMock.CommitTx mock is already set by Expect")
- }
- if mmCommitTx.defaultExpectation.paramPtrs == nil {
- mmCommitTx.defaultExpectation.paramPtrs = &ThingImageRepositoryMockCommitTxParamPtrs{}
- }
- mmCommitTx.defaultExpectation.paramPtrs.tx = &tx
- return mmCommitTx
- }
- // Inspect accepts an inspector function that has same arguments as the ThingImageRepository.CommitTx
- func (mmCommitTx *mThingImageRepositoryMockCommitTx) Inspect(f func(tx *sql.Tx)) *mThingImageRepositoryMockCommitTx {
- if mmCommitTx.mock.inspectFuncCommitTx != nil {
- mmCommitTx.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.CommitTx")
- }
- mmCommitTx.mock.inspectFuncCommitTx = f
- return mmCommitTx
- }
- // Return sets up results that will be returned by ThingImageRepository.CommitTx
- func (mmCommitTx *mThingImageRepositoryMockCommitTx) Return(err error) *ThingImageRepositoryMock {
- if mmCommitTx.mock.funcCommitTx != nil {
- mmCommitTx.mock.t.Fatalf("ThingImageRepositoryMock.CommitTx mock is already set by Set")
- }
- if mmCommitTx.defaultExpectation == nil {
- mmCommitTx.defaultExpectation = &ThingImageRepositoryMockCommitTxExpectation{mock: mmCommitTx.mock}
- }
- mmCommitTx.defaultExpectation.results = &ThingImageRepositoryMockCommitTxResults{err}
- return mmCommitTx.mock
- }
- // Set uses given function f to mock the ThingImageRepository.CommitTx method
- func (mmCommitTx *mThingImageRepositoryMockCommitTx) Set(f func(tx *sql.Tx) (err error)) *ThingImageRepositoryMock {
- if mmCommitTx.defaultExpectation != nil {
- mmCommitTx.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.CommitTx method")
- }
- if len(mmCommitTx.expectations) > 0 {
- mmCommitTx.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.CommitTx method")
- }
- mmCommitTx.mock.funcCommitTx = f
- return mmCommitTx.mock
- }
- // When sets expectation for the ThingImageRepository.CommitTx which will trigger the result defined by the following
- // Then helper
- func (mmCommitTx *mThingImageRepositoryMockCommitTx) When(tx *sql.Tx) *ThingImageRepositoryMockCommitTxExpectation {
- if mmCommitTx.mock.funcCommitTx != nil {
- mmCommitTx.mock.t.Fatalf("ThingImageRepositoryMock.CommitTx mock is already set by Set")
- }
- expectation := &ThingImageRepositoryMockCommitTxExpectation{
- mock: mmCommitTx.mock,
- params: &ThingImageRepositoryMockCommitTxParams{tx},
- }
- mmCommitTx.expectations = append(mmCommitTx.expectations, expectation)
- return expectation
- }
- // Then sets up ThingImageRepository.CommitTx return parameters for the expectation previously defined by the When method
- func (e *ThingImageRepositoryMockCommitTxExpectation) Then(err error) *ThingImageRepositoryMock {
- e.results = &ThingImageRepositoryMockCommitTxResults{err}
- return e.mock
- }
- // Times sets number of times ThingImageRepository.CommitTx should be invoked
- func (mmCommitTx *mThingImageRepositoryMockCommitTx) Times(n uint64) *mThingImageRepositoryMockCommitTx {
- if n == 0 {
- mmCommitTx.mock.t.Fatalf("Times of ThingImageRepositoryMock.CommitTx mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmCommitTx.expectedInvocations, n)
- return mmCommitTx
- }
- func (mmCommitTx *mThingImageRepositoryMockCommitTx) invocationsDone() bool {
- if len(mmCommitTx.expectations) == 0 && mmCommitTx.defaultExpectation == nil && mmCommitTx.mock.funcCommitTx == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmCommitTx.mock.afterCommitTxCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmCommitTx.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // CommitTx implements image.ThingImageRepository
- func (mmCommitTx *ThingImageRepositoryMock) CommitTx(tx *sql.Tx) (err error) {
- mm_atomic.AddUint64(&mmCommitTx.beforeCommitTxCounter, 1)
- defer mm_atomic.AddUint64(&mmCommitTx.afterCommitTxCounter, 1)
- if mmCommitTx.inspectFuncCommitTx != nil {
- mmCommitTx.inspectFuncCommitTx(tx)
- }
- mm_params := ThingImageRepositoryMockCommitTxParams{tx}
- // Record call args
- mmCommitTx.CommitTxMock.mutex.Lock()
- mmCommitTx.CommitTxMock.callArgs = append(mmCommitTx.CommitTxMock.callArgs, &mm_params)
- mmCommitTx.CommitTxMock.mutex.Unlock()
- for _, e := range mmCommitTx.CommitTxMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.err
- }
- }
- if mmCommitTx.CommitTxMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmCommitTx.CommitTxMock.defaultExpectation.Counter, 1)
- mm_want := mmCommitTx.CommitTxMock.defaultExpectation.params
- mm_want_ptrs := mmCommitTx.CommitTxMock.defaultExpectation.paramPtrs
- mm_got := ThingImageRepositoryMockCommitTxParams{tx}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.tx != nil && !minimock.Equal(*mm_want_ptrs.tx, mm_got.tx) {
- mmCommitTx.t.Errorf("ThingImageRepositoryMock.CommitTx got unexpected parameter tx, want: %#v, got: %#v%s\n", *mm_want_ptrs.tx, mm_got.tx, minimock.Diff(*mm_want_ptrs.tx, mm_got.tx))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmCommitTx.t.Errorf("ThingImageRepositoryMock.CommitTx got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmCommitTx.CommitTxMock.defaultExpectation.results
- if mm_results == nil {
- mmCommitTx.t.Fatal("No results are set for the ThingImageRepositoryMock.CommitTx")
- }
- return (*mm_results).err
- }
- if mmCommitTx.funcCommitTx != nil {
- return mmCommitTx.funcCommitTx(tx)
- }
- mmCommitTx.t.Fatalf("Unexpected call to ThingImageRepositoryMock.CommitTx. %v", tx)
- return
- }
- // CommitTxAfterCounter returns a count of finished ThingImageRepositoryMock.CommitTx invocations
- func (mmCommitTx *ThingImageRepositoryMock) CommitTxAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmCommitTx.afterCommitTxCounter)
- }
- // CommitTxBeforeCounter returns a count of ThingImageRepositoryMock.CommitTx invocations
- func (mmCommitTx *ThingImageRepositoryMock) CommitTxBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmCommitTx.beforeCommitTxCounter)
- }
- // Calls returns a list of arguments used in each call to ThingImageRepositoryMock.CommitTx.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmCommitTx *mThingImageRepositoryMockCommitTx) Calls() []*ThingImageRepositoryMockCommitTxParams {
- mmCommitTx.mutex.RLock()
- argCopy := make([]*ThingImageRepositoryMockCommitTxParams, len(mmCommitTx.callArgs))
- copy(argCopy, mmCommitTx.callArgs)
- mmCommitTx.mutex.RUnlock()
- return argCopy
- }
- // MinimockCommitTxDone returns true if the count of the CommitTx invocations corresponds
- // the number of defined expectations
- func (m *ThingImageRepositoryMock) MinimockCommitTxDone() bool {
- if m.CommitTxMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.CommitTxMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.CommitTxMock.invocationsDone()
- }
- // MinimockCommitTxInspect logs each unmet expectation
- func (m *ThingImageRepositoryMock) MinimockCommitTxInspect() {
- for _, e := range m.CommitTxMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.CommitTx with params: %#v", *e.params)
- }
- }
- afterCommitTxCounter := mm_atomic.LoadUint64(&m.afterCommitTxCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.CommitTxMock.defaultExpectation != nil && afterCommitTxCounter < 1 {
- if m.CommitTxMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to ThingImageRepositoryMock.CommitTx")
- } else {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.CommitTx with params: %#v", *m.CommitTxMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcCommitTx != nil && afterCommitTxCounter < 1 {
- m.t.Error("Expected call to ThingImageRepositoryMock.CommitTx")
- }
- if !m.CommitTxMock.invocationsDone() && afterCommitTxCounter > 0 {
- m.t.Errorf("Expected %d calls to ThingImageRepositoryMock.CommitTx but found %d calls",
- mm_atomic.LoadUint64(&m.CommitTxMock.expectedInvocations), afterCommitTxCounter)
- }
- }
- type mThingImageRepositoryMockDelete struct {
- optional bool
- mock *ThingImageRepositoryMock
- defaultExpectation *ThingImageRepositoryMockDeleteExpectation
- expectations []*ThingImageRepositoryMockDeleteExpectation
- callArgs []*ThingImageRepositoryMockDeleteParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // ThingImageRepositoryMockDeleteExpectation specifies expectation struct of the ThingImageRepository.Delete
- type ThingImageRepositoryMockDeleteExpectation struct {
- mock *ThingImageRepositoryMock
- params *ThingImageRepositoryMockDeleteParams
- paramPtrs *ThingImageRepositoryMockDeleteParamPtrs
- results *ThingImageRepositoryMockDeleteResults
- Counter uint64
- }
- // ThingImageRepositoryMockDeleteParams contains parameters of the ThingImageRepository.Delete
- type ThingImageRepositoryMockDeleteParams struct {
- ctx context.Context
- imageID int
- tx *sql.Tx
- }
- // ThingImageRepositoryMockDeleteParamPtrs contains pointers to parameters of the ThingImageRepository.Delete
- type ThingImageRepositoryMockDeleteParamPtrs struct {
- ctx *context.Context
- imageID *int
- tx **sql.Tx
- }
- // ThingImageRepositoryMockDeleteResults contains results of the ThingImageRepository.Delete
- type ThingImageRepositoryMockDeleteResults struct {
- err error
- }
- // 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 (mmDelete *mThingImageRepositoryMockDelete) Optional() *mThingImageRepositoryMockDelete {
- mmDelete.optional = true
- return mmDelete
- }
- // Expect sets up expected params for ThingImageRepository.Delete
- func (mmDelete *mThingImageRepositoryMockDelete) Expect(ctx context.Context, imageID int, tx *sql.Tx) *mThingImageRepositoryMockDelete {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &ThingImageRepositoryMockDeleteExpectation{}
- }
- if mmDelete.defaultExpectation.paramPtrs != nil {
- mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by ExpectParams functions")
- }
- mmDelete.defaultExpectation.params = &ThingImageRepositoryMockDeleteParams{ctx, imageID, tx}
- for _, e := range mmDelete.expectations {
- if minimock.Equal(e.params, mmDelete.defaultExpectation.params) {
- mmDelete.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDelete.defaultExpectation.params)
- }
- }
- return mmDelete
- }
- // ExpectCtxParam1 sets up expected param ctx for ThingImageRepository.Delete
- func (mmDelete *mThingImageRepositoryMockDelete) ExpectCtxParam1(ctx context.Context) *mThingImageRepositoryMockDelete {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &ThingImageRepositoryMockDeleteExpectation{}
- }
- if mmDelete.defaultExpectation.params != nil {
- mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Expect")
- }
- if mmDelete.defaultExpectation.paramPtrs == nil {
- mmDelete.defaultExpectation.paramPtrs = &ThingImageRepositoryMockDeleteParamPtrs{}
- }
- mmDelete.defaultExpectation.paramPtrs.ctx = &ctx
- return mmDelete
- }
- // ExpectImageIDParam2 sets up expected param imageID for ThingImageRepository.Delete
- func (mmDelete *mThingImageRepositoryMockDelete) ExpectImageIDParam2(imageID int) *mThingImageRepositoryMockDelete {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &ThingImageRepositoryMockDeleteExpectation{}
- }
- if mmDelete.defaultExpectation.params != nil {
- mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Expect")
- }
- if mmDelete.defaultExpectation.paramPtrs == nil {
- mmDelete.defaultExpectation.paramPtrs = &ThingImageRepositoryMockDeleteParamPtrs{}
- }
- mmDelete.defaultExpectation.paramPtrs.imageID = &imageID
- return mmDelete
- }
- // ExpectTxParam3 sets up expected param tx for ThingImageRepository.Delete
- func (mmDelete *mThingImageRepositoryMockDelete) ExpectTxParam3(tx *sql.Tx) *mThingImageRepositoryMockDelete {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &ThingImageRepositoryMockDeleteExpectation{}
- }
- if mmDelete.defaultExpectation.params != nil {
- mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Expect")
- }
- if mmDelete.defaultExpectation.paramPtrs == nil {
- mmDelete.defaultExpectation.paramPtrs = &ThingImageRepositoryMockDeleteParamPtrs{}
- }
- mmDelete.defaultExpectation.paramPtrs.tx = &tx
- return mmDelete
- }
- // Inspect accepts an inspector function that has same arguments as the ThingImageRepository.Delete
- func (mmDelete *mThingImageRepositoryMockDelete) Inspect(f func(ctx context.Context, imageID int, tx *sql.Tx)) *mThingImageRepositoryMockDelete {
- if mmDelete.mock.inspectFuncDelete != nil {
- mmDelete.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.Delete")
- }
- mmDelete.mock.inspectFuncDelete = f
- return mmDelete
- }
- // Return sets up results that will be returned by ThingImageRepository.Delete
- func (mmDelete *mThingImageRepositoryMockDelete) Return(err error) *ThingImageRepositoryMock {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &ThingImageRepositoryMockDeleteExpectation{mock: mmDelete.mock}
- }
- mmDelete.defaultExpectation.results = &ThingImageRepositoryMockDeleteResults{err}
- return mmDelete.mock
- }
- // Set uses given function f to mock the ThingImageRepository.Delete method
- func (mmDelete *mThingImageRepositoryMockDelete) Set(f func(ctx context.Context, imageID int, tx *sql.Tx) (err error)) *ThingImageRepositoryMock {
- if mmDelete.defaultExpectation != nil {
- mmDelete.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.Delete method")
- }
- if len(mmDelete.expectations) > 0 {
- mmDelete.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.Delete method")
- }
- mmDelete.mock.funcDelete = f
- return mmDelete.mock
- }
- // When sets expectation for the ThingImageRepository.Delete which will trigger the result defined by the following
- // Then helper
- func (mmDelete *mThingImageRepositoryMockDelete) When(ctx context.Context, imageID int, tx *sql.Tx) *ThingImageRepositoryMockDeleteExpectation {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("ThingImageRepositoryMock.Delete mock is already set by Set")
- }
- expectation := &ThingImageRepositoryMockDeleteExpectation{
- mock: mmDelete.mock,
- params: &ThingImageRepositoryMockDeleteParams{ctx, imageID, tx},
- }
- mmDelete.expectations = append(mmDelete.expectations, expectation)
- return expectation
- }
- // Then sets up ThingImageRepository.Delete return parameters for the expectation previously defined by the When method
- func (e *ThingImageRepositoryMockDeleteExpectation) Then(err error) *ThingImageRepositoryMock {
- e.results = &ThingImageRepositoryMockDeleteResults{err}
- return e.mock
- }
- // Times sets number of times ThingImageRepository.Delete should be invoked
- func (mmDelete *mThingImageRepositoryMockDelete) Times(n uint64) *mThingImageRepositoryMockDelete {
- if n == 0 {
- mmDelete.mock.t.Fatalf("Times of ThingImageRepositoryMock.Delete mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmDelete.expectedInvocations, n)
- return mmDelete
- }
- func (mmDelete *mThingImageRepositoryMockDelete) invocationsDone() bool {
- if len(mmDelete.expectations) == 0 && mmDelete.defaultExpectation == nil && mmDelete.mock.funcDelete == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmDelete.mock.afterDeleteCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmDelete.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // Delete implements image.ThingImageRepository
- func (mmDelete *ThingImageRepositoryMock) Delete(ctx context.Context, imageID int, tx *sql.Tx) (err error) {
- mm_atomic.AddUint64(&mmDelete.beforeDeleteCounter, 1)
- defer mm_atomic.AddUint64(&mmDelete.afterDeleteCounter, 1)
- if mmDelete.inspectFuncDelete != nil {
- mmDelete.inspectFuncDelete(ctx, imageID, tx)
- }
- mm_params := ThingImageRepositoryMockDeleteParams{ctx, imageID, tx}
- // Record call args
- mmDelete.DeleteMock.mutex.Lock()
- mmDelete.DeleteMock.callArgs = append(mmDelete.DeleteMock.callArgs, &mm_params)
- mmDelete.DeleteMock.mutex.Unlock()
- for _, e := range mmDelete.DeleteMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.err
- }
- }
- if mmDelete.DeleteMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmDelete.DeleteMock.defaultExpectation.Counter, 1)
- mm_want := mmDelete.DeleteMock.defaultExpectation.params
- mm_want_ptrs := mmDelete.DeleteMock.defaultExpectation.paramPtrs
- mm_got := ThingImageRepositoryMockDeleteParams{ctx, imageID, tx}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmDelete.t.Errorf("ThingImageRepositoryMock.Delete got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
- }
- if mm_want_ptrs.imageID != nil && !minimock.Equal(*mm_want_ptrs.imageID, mm_got.imageID) {
- mmDelete.t.Errorf("ThingImageRepositoryMock.Delete got unexpected parameter imageID, want: %#v, got: %#v%s\n", *mm_want_ptrs.imageID, mm_got.imageID, minimock.Diff(*mm_want_ptrs.imageID, mm_got.imageID))
- }
- if mm_want_ptrs.tx != nil && !minimock.Equal(*mm_want_ptrs.tx, mm_got.tx) {
- mmDelete.t.Errorf("ThingImageRepositoryMock.Delete got unexpected parameter tx, want: %#v, got: %#v%s\n", *mm_want_ptrs.tx, mm_got.tx, minimock.Diff(*mm_want_ptrs.tx, mm_got.tx))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmDelete.t.Errorf("ThingImageRepositoryMock.Delete got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmDelete.DeleteMock.defaultExpectation.results
- if mm_results == nil {
- mmDelete.t.Fatal("No results are set for the ThingImageRepositoryMock.Delete")
- }
- return (*mm_results).err
- }
- if mmDelete.funcDelete != nil {
- return mmDelete.funcDelete(ctx, imageID, tx)
- }
- mmDelete.t.Fatalf("Unexpected call to ThingImageRepositoryMock.Delete. %v %v %v", ctx, imageID, tx)
- return
- }
- // DeleteAfterCounter returns a count of finished ThingImageRepositoryMock.Delete invocations
- func (mmDelete *ThingImageRepositoryMock) DeleteAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmDelete.afterDeleteCounter)
- }
- // DeleteBeforeCounter returns a count of ThingImageRepositoryMock.Delete invocations
- func (mmDelete *ThingImageRepositoryMock) DeleteBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmDelete.beforeDeleteCounter)
- }
- // Calls returns a list of arguments used in each call to ThingImageRepositoryMock.Delete.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmDelete *mThingImageRepositoryMockDelete) Calls() []*ThingImageRepositoryMockDeleteParams {
- mmDelete.mutex.RLock()
- argCopy := make([]*ThingImageRepositoryMockDeleteParams, len(mmDelete.callArgs))
- copy(argCopy, mmDelete.callArgs)
- mmDelete.mutex.RUnlock()
- return argCopy
- }
- // MinimockDeleteDone returns true if the count of the Delete invocations corresponds
- // the number of defined expectations
- func (m *ThingImageRepositoryMock) MinimockDeleteDone() bool {
- if m.DeleteMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.DeleteMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.DeleteMock.invocationsDone()
- }
- // MinimockDeleteInspect logs each unmet expectation
- func (m *ThingImageRepositoryMock) MinimockDeleteInspect() {
- for _, e := range m.DeleteMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.Delete with params: %#v", *e.params)
- }
- }
- afterDeleteCounter := mm_atomic.LoadUint64(&m.afterDeleteCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.DeleteMock.defaultExpectation != nil && afterDeleteCounter < 1 {
- if m.DeleteMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to ThingImageRepositoryMock.Delete")
- } else {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.Delete with params: %#v", *m.DeleteMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcDelete != nil && afterDeleteCounter < 1 {
- m.t.Error("Expected call to ThingImageRepositoryMock.Delete")
- }
- if !m.DeleteMock.invocationsDone() && afterDeleteCounter > 0 {
- m.t.Errorf("Expected %d calls to ThingImageRepositoryMock.Delete but found %d calls",
- mm_atomic.LoadUint64(&m.DeleteMock.expectedInvocations), afterDeleteCounter)
- }
- }
- type mThingImageRepositoryMockGet struct {
- optional bool
- mock *ThingImageRepositoryMock
- defaultExpectation *ThingImageRepositoryMockGetExpectation
- expectations []*ThingImageRepositoryMockGetExpectation
- callArgs []*ThingImageRepositoryMockGetParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // ThingImageRepositoryMockGetExpectation specifies expectation struct of the ThingImageRepository.Get
- type ThingImageRepositoryMockGetExpectation struct {
- mock *ThingImageRepositoryMock
- params *ThingImageRepositoryMockGetParams
- paramPtrs *ThingImageRepositoryMockGetParamPtrs
- results *ThingImageRepositoryMockGetResults
- Counter uint64
- }
- // ThingImageRepositoryMockGetParams contains parameters of the ThingImageRepository.Get
- type ThingImageRepositoryMockGetParams struct {
- ctx context.Context
- imageID int
- }
- // ThingImageRepositoryMockGetParamPtrs contains pointers to parameters of the ThingImageRepository.Get
- type ThingImageRepositoryMockGetParamPtrs struct {
- ctx *context.Context
- imageID *int
- }
- // ThingImageRepositoryMockGetResults contains results of the ThingImageRepository.Get
- type ThingImageRepositoryMockGetResults struct {
- ip1 *models.Image
- err error
- }
- // 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 (mmGet *mThingImageRepositoryMockGet) Optional() *mThingImageRepositoryMockGet {
- mmGet.optional = true
- return mmGet
- }
- // Expect sets up expected params for ThingImageRepository.Get
- func (mmGet *mThingImageRepositoryMockGet) Expect(ctx context.Context, imageID int) *mThingImageRepositoryMockGet {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by Set")
- }
- if mmGet.defaultExpectation == nil {
- mmGet.defaultExpectation = &ThingImageRepositoryMockGetExpectation{}
- }
- if mmGet.defaultExpectation.paramPtrs != nil {
- mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by ExpectParams functions")
- }
- mmGet.defaultExpectation.params = &ThingImageRepositoryMockGetParams{ctx, imageID}
- for _, e := range mmGet.expectations {
- if minimock.Equal(e.params, mmGet.defaultExpectation.params) {
- mmGet.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGet.defaultExpectation.params)
- }
- }
- return mmGet
- }
- // ExpectCtxParam1 sets up expected param ctx for ThingImageRepository.Get
- func (mmGet *mThingImageRepositoryMockGet) ExpectCtxParam1(ctx context.Context) *mThingImageRepositoryMockGet {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by Set")
- }
- if mmGet.defaultExpectation == nil {
- mmGet.defaultExpectation = &ThingImageRepositoryMockGetExpectation{}
- }
- if mmGet.defaultExpectation.params != nil {
- mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by Expect")
- }
- if mmGet.defaultExpectation.paramPtrs == nil {
- mmGet.defaultExpectation.paramPtrs = &ThingImageRepositoryMockGetParamPtrs{}
- }
- mmGet.defaultExpectation.paramPtrs.ctx = &ctx
- return mmGet
- }
- // ExpectImageIDParam2 sets up expected param imageID for ThingImageRepository.Get
- func (mmGet *mThingImageRepositoryMockGet) ExpectImageIDParam2(imageID int) *mThingImageRepositoryMockGet {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by Set")
- }
- if mmGet.defaultExpectation == nil {
- mmGet.defaultExpectation = &ThingImageRepositoryMockGetExpectation{}
- }
- if mmGet.defaultExpectation.params != nil {
- mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by Expect")
- }
- if mmGet.defaultExpectation.paramPtrs == nil {
- mmGet.defaultExpectation.paramPtrs = &ThingImageRepositoryMockGetParamPtrs{}
- }
- mmGet.defaultExpectation.paramPtrs.imageID = &imageID
- return mmGet
- }
- // Inspect accepts an inspector function that has same arguments as the ThingImageRepository.Get
- func (mmGet *mThingImageRepositoryMockGet) Inspect(f func(ctx context.Context, imageID int)) *mThingImageRepositoryMockGet {
- if mmGet.mock.inspectFuncGet != nil {
- mmGet.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.Get")
- }
- mmGet.mock.inspectFuncGet = f
- return mmGet
- }
- // Return sets up results that will be returned by ThingImageRepository.Get
- func (mmGet *mThingImageRepositoryMockGet) Return(ip1 *models.Image, err error) *ThingImageRepositoryMock {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by Set")
- }
- if mmGet.defaultExpectation == nil {
- mmGet.defaultExpectation = &ThingImageRepositoryMockGetExpectation{mock: mmGet.mock}
- }
- mmGet.defaultExpectation.results = &ThingImageRepositoryMockGetResults{ip1, err}
- return mmGet.mock
- }
- // Set uses given function f to mock the ThingImageRepository.Get method
- func (mmGet *mThingImageRepositoryMockGet) Set(f func(ctx context.Context, imageID int) (ip1 *models.Image, err error)) *ThingImageRepositoryMock {
- if mmGet.defaultExpectation != nil {
- mmGet.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.Get method")
- }
- if len(mmGet.expectations) > 0 {
- mmGet.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.Get method")
- }
- mmGet.mock.funcGet = f
- return mmGet.mock
- }
- // When sets expectation for the ThingImageRepository.Get which will trigger the result defined by the following
- // Then helper
- func (mmGet *mThingImageRepositoryMockGet) When(ctx context.Context, imageID int) *ThingImageRepositoryMockGetExpectation {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("ThingImageRepositoryMock.Get mock is already set by Set")
- }
- expectation := &ThingImageRepositoryMockGetExpectation{
- mock: mmGet.mock,
- params: &ThingImageRepositoryMockGetParams{ctx, imageID},
- }
- mmGet.expectations = append(mmGet.expectations, expectation)
- return expectation
- }
- // Then sets up ThingImageRepository.Get return parameters for the expectation previously defined by the When method
- func (e *ThingImageRepositoryMockGetExpectation) Then(ip1 *models.Image, err error) *ThingImageRepositoryMock {
- e.results = &ThingImageRepositoryMockGetResults{ip1, err}
- return e.mock
- }
- // Times sets number of times ThingImageRepository.Get should be invoked
- func (mmGet *mThingImageRepositoryMockGet) Times(n uint64) *mThingImageRepositoryMockGet {
- if n == 0 {
- mmGet.mock.t.Fatalf("Times of ThingImageRepositoryMock.Get mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmGet.expectedInvocations, n)
- return mmGet
- }
- func (mmGet *mThingImageRepositoryMockGet) invocationsDone() bool {
- if len(mmGet.expectations) == 0 && mmGet.defaultExpectation == nil && mmGet.mock.funcGet == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmGet.mock.afterGetCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmGet.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // Get implements image.ThingImageRepository
- func (mmGet *ThingImageRepositoryMock) Get(ctx context.Context, imageID int) (ip1 *models.Image, err error) {
- mm_atomic.AddUint64(&mmGet.beforeGetCounter, 1)
- defer mm_atomic.AddUint64(&mmGet.afterGetCounter, 1)
- if mmGet.inspectFuncGet != nil {
- mmGet.inspectFuncGet(ctx, imageID)
- }
- mm_params := ThingImageRepositoryMockGetParams{ctx, imageID}
- // Record call args
- mmGet.GetMock.mutex.Lock()
- mmGet.GetMock.callArgs = append(mmGet.GetMock.callArgs, &mm_params)
- mmGet.GetMock.mutex.Unlock()
- for _, e := range mmGet.GetMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.ip1, e.results.err
- }
- }
- if mmGet.GetMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmGet.GetMock.defaultExpectation.Counter, 1)
- mm_want := mmGet.GetMock.defaultExpectation.params
- mm_want_ptrs := mmGet.GetMock.defaultExpectation.paramPtrs
- mm_got := ThingImageRepositoryMockGetParams{ctx, imageID}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmGet.t.Errorf("ThingImageRepositoryMock.Get got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
- }
- if mm_want_ptrs.imageID != nil && !minimock.Equal(*mm_want_ptrs.imageID, mm_got.imageID) {
- mmGet.t.Errorf("ThingImageRepositoryMock.Get got unexpected parameter imageID, want: %#v, got: %#v%s\n", *mm_want_ptrs.imageID, mm_got.imageID, minimock.Diff(*mm_want_ptrs.imageID, mm_got.imageID))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmGet.t.Errorf("ThingImageRepositoryMock.Get got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmGet.GetMock.defaultExpectation.results
- if mm_results == nil {
- mmGet.t.Fatal("No results are set for the ThingImageRepositoryMock.Get")
- }
- return (*mm_results).ip1, (*mm_results).err
- }
- if mmGet.funcGet != nil {
- return mmGet.funcGet(ctx, imageID)
- }
- mmGet.t.Fatalf("Unexpected call to ThingImageRepositoryMock.Get. %v %v", ctx, imageID)
- return
- }
- // GetAfterCounter returns a count of finished ThingImageRepositoryMock.Get invocations
- func (mmGet *ThingImageRepositoryMock) GetAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGet.afterGetCounter)
- }
- // GetBeforeCounter returns a count of ThingImageRepositoryMock.Get invocations
- func (mmGet *ThingImageRepositoryMock) GetBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGet.beforeGetCounter)
- }
- // Calls returns a list of arguments used in each call to ThingImageRepositoryMock.Get.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGet *mThingImageRepositoryMockGet) Calls() []*ThingImageRepositoryMockGetParams {
- mmGet.mutex.RLock()
- argCopy := make([]*ThingImageRepositoryMockGetParams, len(mmGet.callArgs))
- copy(argCopy, mmGet.callArgs)
- mmGet.mutex.RUnlock()
- return argCopy
- }
- // MinimockGetDone returns true if the count of the Get invocations corresponds
- // the number of defined expectations
- func (m *ThingImageRepositoryMock) MinimockGetDone() bool {
- if m.GetMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.GetMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.GetMock.invocationsDone()
- }
- // MinimockGetInspect logs each unmet expectation
- func (m *ThingImageRepositoryMock) MinimockGetInspect() {
- for _, e := range m.GetMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.Get with params: %#v", *e.params)
- }
- }
- afterGetCounter := mm_atomic.LoadUint64(&m.afterGetCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.GetMock.defaultExpectation != nil && afterGetCounter < 1 {
- if m.GetMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to ThingImageRepositoryMock.Get")
- } else {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.Get with params: %#v", *m.GetMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcGet != nil && afterGetCounter < 1 {
- m.t.Error("Expected call to ThingImageRepositoryMock.Get")
- }
- if !m.GetMock.invocationsDone() && afterGetCounter > 0 {
- m.t.Errorf("Expected %d calls to ThingImageRepositoryMock.Get but found %d calls",
- mm_atomic.LoadUint64(&m.GetMock.expectedInvocations), afterGetCounter)
- }
- }
- type mThingImageRepositoryMockGetByPlaceID struct {
- optional bool
- mock *ThingImageRepositoryMock
- defaultExpectation *ThingImageRepositoryMockGetByPlaceIDExpectation
- expectations []*ThingImageRepositoryMockGetByPlaceIDExpectation
- callArgs []*ThingImageRepositoryMockGetByPlaceIDParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // ThingImageRepositoryMockGetByPlaceIDExpectation specifies expectation struct of the ThingImageRepository.GetByPlaceID
- type ThingImageRepositoryMockGetByPlaceIDExpectation struct {
- mock *ThingImageRepositoryMock
- params *ThingImageRepositoryMockGetByPlaceIDParams
- paramPtrs *ThingImageRepositoryMockGetByPlaceIDParamPtrs
- results *ThingImageRepositoryMockGetByPlaceIDResults
- Counter uint64
- }
- // ThingImageRepositoryMockGetByPlaceIDParams contains parameters of the ThingImageRepository.GetByPlaceID
- type ThingImageRepositoryMockGetByPlaceIDParams struct {
- ctx context.Context
- placeID int
- }
- // ThingImageRepositoryMockGetByPlaceIDParamPtrs contains pointers to parameters of the ThingImageRepository.GetByPlaceID
- type ThingImageRepositoryMockGetByPlaceIDParamPtrs struct {
- ctx *context.Context
- placeID *int
- }
- // ThingImageRepositoryMockGetByPlaceIDResults contains results of the ThingImageRepository.GetByPlaceID
- type ThingImageRepositoryMockGetByPlaceIDResults struct {
- ia1 []models.Image
- err error
- }
- // 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 (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Optional() *mThingImageRepositoryMockGetByPlaceID {
- mmGetByPlaceID.optional = true
- return mmGetByPlaceID
- }
- // Expect sets up expected params for ThingImageRepository.GetByPlaceID
- func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Expect(ctx context.Context, placeID int) *mThingImageRepositoryMockGetByPlaceID {
- if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
- mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by Set")
- }
- if mmGetByPlaceID.defaultExpectation == nil {
- mmGetByPlaceID.defaultExpectation = &ThingImageRepositoryMockGetByPlaceIDExpectation{}
- }
- if mmGetByPlaceID.defaultExpectation.paramPtrs != nil {
- mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by ExpectParams functions")
- }
- mmGetByPlaceID.defaultExpectation.params = &ThingImageRepositoryMockGetByPlaceIDParams{ctx, placeID}
- for _, e := range mmGetByPlaceID.expectations {
- if minimock.Equal(e.params, mmGetByPlaceID.defaultExpectation.params) {
- mmGetByPlaceID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByPlaceID.defaultExpectation.params)
- }
- }
- return mmGetByPlaceID
- }
- // ExpectCtxParam1 sets up expected param ctx for ThingImageRepository.GetByPlaceID
- func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) ExpectCtxParam1(ctx context.Context) *mThingImageRepositoryMockGetByPlaceID {
- if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
- mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by Set")
- }
- if mmGetByPlaceID.defaultExpectation == nil {
- mmGetByPlaceID.defaultExpectation = &ThingImageRepositoryMockGetByPlaceIDExpectation{}
- }
- if mmGetByPlaceID.defaultExpectation.params != nil {
- mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by Expect")
- }
- if mmGetByPlaceID.defaultExpectation.paramPtrs == nil {
- mmGetByPlaceID.defaultExpectation.paramPtrs = &ThingImageRepositoryMockGetByPlaceIDParamPtrs{}
- }
- mmGetByPlaceID.defaultExpectation.paramPtrs.ctx = &ctx
- return mmGetByPlaceID
- }
- // ExpectPlaceIDParam2 sets up expected param placeID for ThingImageRepository.GetByPlaceID
- func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) ExpectPlaceIDParam2(placeID int) *mThingImageRepositoryMockGetByPlaceID {
- if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
- mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by Set")
- }
- if mmGetByPlaceID.defaultExpectation == nil {
- mmGetByPlaceID.defaultExpectation = &ThingImageRepositoryMockGetByPlaceIDExpectation{}
- }
- if mmGetByPlaceID.defaultExpectation.params != nil {
- mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by Expect")
- }
- if mmGetByPlaceID.defaultExpectation.paramPtrs == nil {
- mmGetByPlaceID.defaultExpectation.paramPtrs = &ThingImageRepositoryMockGetByPlaceIDParamPtrs{}
- }
- mmGetByPlaceID.defaultExpectation.paramPtrs.placeID = &placeID
- return mmGetByPlaceID
- }
- // Inspect accepts an inspector function that has same arguments as the ThingImageRepository.GetByPlaceID
- func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Inspect(f func(ctx context.Context, placeID int)) *mThingImageRepositoryMockGetByPlaceID {
- if mmGetByPlaceID.mock.inspectFuncGetByPlaceID != nil {
- mmGetByPlaceID.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.GetByPlaceID")
- }
- mmGetByPlaceID.mock.inspectFuncGetByPlaceID = f
- return mmGetByPlaceID
- }
- // Return sets up results that will be returned by ThingImageRepository.GetByPlaceID
- func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Return(ia1 []models.Image, err error) *ThingImageRepositoryMock {
- if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
- mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by Set")
- }
- if mmGetByPlaceID.defaultExpectation == nil {
- mmGetByPlaceID.defaultExpectation = &ThingImageRepositoryMockGetByPlaceIDExpectation{mock: mmGetByPlaceID.mock}
- }
- mmGetByPlaceID.defaultExpectation.results = &ThingImageRepositoryMockGetByPlaceIDResults{ia1, err}
- return mmGetByPlaceID.mock
- }
- // Set uses given function f to mock the ThingImageRepository.GetByPlaceID method
- func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Set(f func(ctx context.Context, placeID int) (ia1 []models.Image, err error)) *ThingImageRepositoryMock {
- if mmGetByPlaceID.defaultExpectation != nil {
- mmGetByPlaceID.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.GetByPlaceID method")
- }
- if len(mmGetByPlaceID.expectations) > 0 {
- mmGetByPlaceID.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.GetByPlaceID method")
- }
- mmGetByPlaceID.mock.funcGetByPlaceID = f
- return mmGetByPlaceID.mock
- }
- // When sets expectation for the ThingImageRepository.GetByPlaceID which will trigger the result defined by the following
- // Then helper
- func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) When(ctx context.Context, placeID int) *ThingImageRepositoryMockGetByPlaceIDExpectation {
- if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
- mmGetByPlaceID.mock.t.Fatalf("ThingImageRepositoryMock.GetByPlaceID mock is already set by Set")
- }
- expectation := &ThingImageRepositoryMockGetByPlaceIDExpectation{
- mock: mmGetByPlaceID.mock,
- params: &ThingImageRepositoryMockGetByPlaceIDParams{ctx, placeID},
- }
- mmGetByPlaceID.expectations = append(mmGetByPlaceID.expectations, expectation)
- return expectation
- }
- // Then sets up ThingImageRepository.GetByPlaceID return parameters for the expectation previously defined by the When method
- func (e *ThingImageRepositoryMockGetByPlaceIDExpectation) Then(ia1 []models.Image, err error) *ThingImageRepositoryMock {
- e.results = &ThingImageRepositoryMockGetByPlaceIDResults{ia1, err}
- return e.mock
- }
- // Times sets number of times ThingImageRepository.GetByPlaceID should be invoked
- func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Times(n uint64) *mThingImageRepositoryMockGetByPlaceID {
- if n == 0 {
- mmGetByPlaceID.mock.t.Fatalf("Times of ThingImageRepositoryMock.GetByPlaceID mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmGetByPlaceID.expectedInvocations, n)
- return mmGetByPlaceID
- }
- func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) invocationsDone() bool {
- if len(mmGetByPlaceID.expectations) == 0 && mmGetByPlaceID.defaultExpectation == nil && mmGetByPlaceID.mock.funcGetByPlaceID == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmGetByPlaceID.mock.afterGetByPlaceIDCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmGetByPlaceID.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // GetByPlaceID implements image.ThingImageRepository
- func (mmGetByPlaceID *ThingImageRepositoryMock) GetByPlaceID(ctx context.Context, placeID int) (ia1 []models.Image, err error) {
- mm_atomic.AddUint64(&mmGetByPlaceID.beforeGetByPlaceIDCounter, 1)
- defer mm_atomic.AddUint64(&mmGetByPlaceID.afterGetByPlaceIDCounter, 1)
- if mmGetByPlaceID.inspectFuncGetByPlaceID != nil {
- mmGetByPlaceID.inspectFuncGetByPlaceID(ctx, placeID)
- }
- mm_params := ThingImageRepositoryMockGetByPlaceIDParams{ctx, placeID}
- // Record call args
- mmGetByPlaceID.GetByPlaceIDMock.mutex.Lock()
- mmGetByPlaceID.GetByPlaceIDMock.callArgs = append(mmGetByPlaceID.GetByPlaceIDMock.callArgs, &mm_params)
- mmGetByPlaceID.GetByPlaceIDMock.mutex.Unlock()
- for _, e := range mmGetByPlaceID.GetByPlaceIDMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.ia1, e.results.err
- }
- }
- if mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.Counter, 1)
- mm_want := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.params
- mm_want_ptrs := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.paramPtrs
- mm_got := ThingImageRepositoryMockGetByPlaceIDParams{ctx, placeID}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmGetByPlaceID.t.Errorf("ThingImageRepositoryMock.GetByPlaceID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
- }
- if mm_want_ptrs.placeID != nil && !minimock.Equal(*mm_want_ptrs.placeID, mm_got.placeID) {
- mmGetByPlaceID.t.Errorf("ThingImageRepositoryMock.GetByPlaceID got unexpected parameter placeID, want: %#v, got: %#v%s\n", *mm_want_ptrs.placeID, mm_got.placeID, minimock.Diff(*mm_want_ptrs.placeID, mm_got.placeID))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmGetByPlaceID.t.Errorf("ThingImageRepositoryMock.GetByPlaceID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.results
- if mm_results == nil {
- mmGetByPlaceID.t.Fatal("No results are set for the ThingImageRepositoryMock.GetByPlaceID")
- }
- return (*mm_results).ia1, (*mm_results).err
- }
- if mmGetByPlaceID.funcGetByPlaceID != nil {
- return mmGetByPlaceID.funcGetByPlaceID(ctx, placeID)
- }
- mmGetByPlaceID.t.Fatalf("Unexpected call to ThingImageRepositoryMock.GetByPlaceID. %v %v", ctx, placeID)
- return
- }
- // GetByPlaceIDAfterCounter returns a count of finished ThingImageRepositoryMock.GetByPlaceID invocations
- func (mmGetByPlaceID *ThingImageRepositoryMock) GetByPlaceIDAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetByPlaceID.afterGetByPlaceIDCounter)
- }
- // GetByPlaceIDBeforeCounter returns a count of ThingImageRepositoryMock.GetByPlaceID invocations
- func (mmGetByPlaceID *ThingImageRepositoryMock) GetByPlaceIDBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetByPlaceID.beforeGetByPlaceIDCounter)
- }
- // Calls returns a list of arguments used in each call to ThingImageRepositoryMock.GetByPlaceID.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGetByPlaceID *mThingImageRepositoryMockGetByPlaceID) Calls() []*ThingImageRepositoryMockGetByPlaceIDParams {
- mmGetByPlaceID.mutex.RLock()
- argCopy := make([]*ThingImageRepositoryMockGetByPlaceIDParams, len(mmGetByPlaceID.callArgs))
- copy(argCopy, mmGetByPlaceID.callArgs)
- mmGetByPlaceID.mutex.RUnlock()
- return argCopy
- }
- // MinimockGetByPlaceIDDone returns true if the count of the GetByPlaceID invocations corresponds
- // the number of defined expectations
- func (m *ThingImageRepositoryMock) MinimockGetByPlaceIDDone() bool {
- if m.GetByPlaceIDMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.GetByPlaceIDMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.GetByPlaceIDMock.invocationsDone()
- }
- // MinimockGetByPlaceIDInspect logs each unmet expectation
- func (m *ThingImageRepositoryMock) MinimockGetByPlaceIDInspect() {
- for _, e := range m.GetByPlaceIDMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.GetByPlaceID with params: %#v", *e.params)
- }
- }
- afterGetByPlaceIDCounter := mm_atomic.LoadUint64(&m.afterGetByPlaceIDCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.GetByPlaceIDMock.defaultExpectation != nil && afterGetByPlaceIDCounter < 1 {
- if m.GetByPlaceIDMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to ThingImageRepositoryMock.GetByPlaceID")
- } else {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.GetByPlaceID with params: %#v", *m.GetByPlaceIDMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcGetByPlaceID != nil && afterGetByPlaceIDCounter < 1 {
- m.t.Error("Expected call to ThingImageRepositoryMock.GetByPlaceID")
- }
- if !m.GetByPlaceIDMock.invocationsDone() && afterGetByPlaceIDCounter > 0 {
- m.t.Errorf("Expected %d calls to ThingImageRepositoryMock.GetByPlaceID but found %d calls",
- mm_atomic.LoadUint64(&m.GetByPlaceIDMock.expectedInvocations), afterGetByPlaceIDCounter)
- }
- }
- type mThingImageRepositoryMockGetByThingID struct {
- optional bool
- mock *ThingImageRepositoryMock
- defaultExpectation *ThingImageRepositoryMockGetByThingIDExpectation
- expectations []*ThingImageRepositoryMockGetByThingIDExpectation
- callArgs []*ThingImageRepositoryMockGetByThingIDParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // ThingImageRepositoryMockGetByThingIDExpectation specifies expectation struct of the ThingImageRepository.GetByThingID
- type ThingImageRepositoryMockGetByThingIDExpectation struct {
- mock *ThingImageRepositoryMock
- params *ThingImageRepositoryMockGetByThingIDParams
- paramPtrs *ThingImageRepositoryMockGetByThingIDParamPtrs
- results *ThingImageRepositoryMockGetByThingIDResults
- Counter uint64
- }
- // ThingImageRepositoryMockGetByThingIDParams contains parameters of the ThingImageRepository.GetByThingID
- type ThingImageRepositoryMockGetByThingIDParams struct {
- ctx context.Context
- thingID int
- }
- // ThingImageRepositoryMockGetByThingIDParamPtrs contains pointers to parameters of the ThingImageRepository.GetByThingID
- type ThingImageRepositoryMockGetByThingIDParamPtrs struct {
- ctx *context.Context
- thingID *int
- }
- // ThingImageRepositoryMockGetByThingIDResults contains results of the ThingImageRepository.GetByThingID
- type ThingImageRepositoryMockGetByThingIDResults struct {
- ia1 []models.Image
- err error
- }
- // 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 (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Optional() *mThingImageRepositoryMockGetByThingID {
- mmGetByThingID.optional = true
- return mmGetByThingID
- }
- // Expect sets up expected params for ThingImageRepository.GetByThingID
- func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Expect(ctx context.Context, thingID int) *mThingImageRepositoryMockGetByThingID {
- if mmGetByThingID.mock.funcGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by Set")
- }
- if mmGetByThingID.defaultExpectation == nil {
- mmGetByThingID.defaultExpectation = &ThingImageRepositoryMockGetByThingIDExpectation{}
- }
- if mmGetByThingID.defaultExpectation.paramPtrs != nil {
- mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by ExpectParams functions")
- }
- mmGetByThingID.defaultExpectation.params = &ThingImageRepositoryMockGetByThingIDParams{ctx, thingID}
- for _, e := range mmGetByThingID.expectations {
- if minimock.Equal(e.params, mmGetByThingID.defaultExpectation.params) {
- mmGetByThingID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByThingID.defaultExpectation.params)
- }
- }
- return mmGetByThingID
- }
- // ExpectCtxParam1 sets up expected param ctx for ThingImageRepository.GetByThingID
- func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) ExpectCtxParam1(ctx context.Context) *mThingImageRepositoryMockGetByThingID {
- if mmGetByThingID.mock.funcGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by Set")
- }
- if mmGetByThingID.defaultExpectation == nil {
- mmGetByThingID.defaultExpectation = &ThingImageRepositoryMockGetByThingIDExpectation{}
- }
- if mmGetByThingID.defaultExpectation.params != nil {
- mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by Expect")
- }
- if mmGetByThingID.defaultExpectation.paramPtrs == nil {
- mmGetByThingID.defaultExpectation.paramPtrs = &ThingImageRepositoryMockGetByThingIDParamPtrs{}
- }
- mmGetByThingID.defaultExpectation.paramPtrs.ctx = &ctx
- return mmGetByThingID
- }
- // ExpectThingIDParam2 sets up expected param thingID for ThingImageRepository.GetByThingID
- func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) ExpectThingIDParam2(thingID int) *mThingImageRepositoryMockGetByThingID {
- if mmGetByThingID.mock.funcGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by Set")
- }
- if mmGetByThingID.defaultExpectation == nil {
- mmGetByThingID.defaultExpectation = &ThingImageRepositoryMockGetByThingIDExpectation{}
- }
- if mmGetByThingID.defaultExpectation.params != nil {
- mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by Expect")
- }
- if mmGetByThingID.defaultExpectation.paramPtrs == nil {
- mmGetByThingID.defaultExpectation.paramPtrs = &ThingImageRepositoryMockGetByThingIDParamPtrs{}
- }
- mmGetByThingID.defaultExpectation.paramPtrs.thingID = &thingID
- return mmGetByThingID
- }
- // Inspect accepts an inspector function that has same arguments as the ThingImageRepository.GetByThingID
- func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Inspect(f func(ctx context.Context, thingID int)) *mThingImageRepositoryMockGetByThingID {
- if mmGetByThingID.mock.inspectFuncGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("Inspect function is already set for ThingImageRepositoryMock.GetByThingID")
- }
- mmGetByThingID.mock.inspectFuncGetByThingID = f
- return mmGetByThingID
- }
- // Return sets up results that will be returned by ThingImageRepository.GetByThingID
- func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Return(ia1 []models.Image, err error) *ThingImageRepositoryMock {
- if mmGetByThingID.mock.funcGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by Set")
- }
- if mmGetByThingID.defaultExpectation == nil {
- mmGetByThingID.defaultExpectation = &ThingImageRepositoryMockGetByThingIDExpectation{mock: mmGetByThingID.mock}
- }
- mmGetByThingID.defaultExpectation.results = &ThingImageRepositoryMockGetByThingIDResults{ia1, err}
- return mmGetByThingID.mock
- }
- // Set uses given function f to mock the ThingImageRepository.GetByThingID method
- func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Set(f func(ctx context.Context, thingID int) (ia1 []models.Image, err error)) *ThingImageRepositoryMock {
- if mmGetByThingID.defaultExpectation != nil {
- mmGetByThingID.mock.t.Fatalf("Default expectation is already set for the ThingImageRepository.GetByThingID method")
- }
- if len(mmGetByThingID.expectations) > 0 {
- mmGetByThingID.mock.t.Fatalf("Some expectations are already set for the ThingImageRepository.GetByThingID method")
- }
- mmGetByThingID.mock.funcGetByThingID = f
- return mmGetByThingID.mock
- }
- // When sets expectation for the ThingImageRepository.GetByThingID which will trigger the result defined by the following
- // Then helper
- func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) When(ctx context.Context, thingID int) *ThingImageRepositoryMockGetByThingIDExpectation {
- if mmGetByThingID.mock.funcGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("ThingImageRepositoryMock.GetByThingID mock is already set by Set")
- }
- expectation := &ThingImageRepositoryMockGetByThingIDExpectation{
- mock: mmGetByThingID.mock,
- params: &ThingImageRepositoryMockGetByThingIDParams{ctx, thingID},
- }
- mmGetByThingID.expectations = append(mmGetByThingID.expectations, expectation)
- return expectation
- }
- // Then sets up ThingImageRepository.GetByThingID return parameters for the expectation previously defined by the When method
- func (e *ThingImageRepositoryMockGetByThingIDExpectation) Then(ia1 []models.Image, err error) *ThingImageRepositoryMock {
- e.results = &ThingImageRepositoryMockGetByThingIDResults{ia1, err}
- return e.mock
- }
- // Times sets number of times ThingImageRepository.GetByThingID should be invoked
- func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Times(n uint64) *mThingImageRepositoryMockGetByThingID {
- if n == 0 {
- mmGetByThingID.mock.t.Fatalf("Times of ThingImageRepositoryMock.GetByThingID mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmGetByThingID.expectedInvocations, n)
- return mmGetByThingID
- }
- func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) invocationsDone() bool {
- if len(mmGetByThingID.expectations) == 0 && mmGetByThingID.defaultExpectation == nil && mmGetByThingID.mock.funcGetByThingID == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmGetByThingID.mock.afterGetByThingIDCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmGetByThingID.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // GetByThingID implements image.ThingImageRepository
- func (mmGetByThingID *ThingImageRepositoryMock) GetByThingID(ctx context.Context, thingID int) (ia1 []models.Image, err error) {
- mm_atomic.AddUint64(&mmGetByThingID.beforeGetByThingIDCounter, 1)
- defer mm_atomic.AddUint64(&mmGetByThingID.afterGetByThingIDCounter, 1)
- if mmGetByThingID.inspectFuncGetByThingID != nil {
- mmGetByThingID.inspectFuncGetByThingID(ctx, thingID)
- }
- mm_params := ThingImageRepositoryMockGetByThingIDParams{ctx, thingID}
- // Record call args
- mmGetByThingID.GetByThingIDMock.mutex.Lock()
- mmGetByThingID.GetByThingIDMock.callArgs = append(mmGetByThingID.GetByThingIDMock.callArgs, &mm_params)
- mmGetByThingID.GetByThingIDMock.mutex.Unlock()
- for _, e := range mmGetByThingID.GetByThingIDMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.ia1, e.results.err
- }
- }
- if mmGetByThingID.GetByThingIDMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmGetByThingID.GetByThingIDMock.defaultExpectation.Counter, 1)
- mm_want := mmGetByThingID.GetByThingIDMock.defaultExpectation.params
- mm_want_ptrs := mmGetByThingID.GetByThingIDMock.defaultExpectation.paramPtrs
- mm_got := ThingImageRepositoryMockGetByThingIDParams{ctx, thingID}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmGetByThingID.t.Errorf("ThingImageRepositoryMock.GetByThingID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
- }
- if mm_want_ptrs.thingID != nil && !minimock.Equal(*mm_want_ptrs.thingID, mm_got.thingID) {
- mmGetByThingID.t.Errorf("ThingImageRepositoryMock.GetByThingID got unexpected parameter thingID, want: %#v, got: %#v%s\n", *mm_want_ptrs.thingID, mm_got.thingID, minimock.Diff(*mm_want_ptrs.thingID, mm_got.thingID))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmGetByThingID.t.Errorf("ThingImageRepositoryMock.GetByThingID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmGetByThingID.GetByThingIDMock.defaultExpectation.results
- if mm_results == nil {
- mmGetByThingID.t.Fatal("No results are set for the ThingImageRepositoryMock.GetByThingID")
- }
- return (*mm_results).ia1, (*mm_results).err
- }
- if mmGetByThingID.funcGetByThingID != nil {
- return mmGetByThingID.funcGetByThingID(ctx, thingID)
- }
- mmGetByThingID.t.Fatalf("Unexpected call to ThingImageRepositoryMock.GetByThingID. %v %v", ctx, thingID)
- return
- }
- // GetByThingIDAfterCounter returns a count of finished ThingImageRepositoryMock.GetByThingID invocations
- func (mmGetByThingID *ThingImageRepositoryMock) GetByThingIDAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetByThingID.afterGetByThingIDCounter)
- }
- // GetByThingIDBeforeCounter returns a count of ThingImageRepositoryMock.GetByThingID invocations
- func (mmGetByThingID *ThingImageRepositoryMock) GetByThingIDBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetByThingID.beforeGetByThingIDCounter)
- }
- // Calls returns a list of arguments used in each call to ThingImageRepositoryMock.GetByThingID.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGetByThingID *mThingImageRepositoryMockGetByThingID) Calls() []*ThingImageRepositoryMockGetByThingIDParams {
- mmGetByThingID.mutex.RLock()
- argCopy := make([]*ThingImageRepositoryMockGetByThingIDParams, len(mmGetByThingID.callArgs))
- copy(argCopy, mmGetByThingID.callArgs)
- mmGetByThingID.mutex.RUnlock()
- return argCopy
- }
- // MinimockGetByThingIDDone returns true if the count of the GetByThingID invocations corresponds
- // the number of defined expectations
- func (m *ThingImageRepositoryMock) MinimockGetByThingIDDone() bool {
- if m.GetByThingIDMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.GetByThingIDMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.GetByThingIDMock.invocationsDone()
- }
- // MinimockGetByThingIDInspect logs each unmet expectation
- func (m *ThingImageRepositoryMock) MinimockGetByThingIDInspect() {
- for _, e := range m.GetByThingIDMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.GetByThingID with params: %#v", *e.params)
- }
- }
- afterGetByThingIDCounter := mm_atomic.LoadUint64(&m.afterGetByThingIDCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.GetByThingIDMock.defaultExpectation != nil && afterGetByThingIDCounter < 1 {
- if m.GetByThingIDMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to ThingImageRepositoryMock.GetByThingID")
- } else {
- m.t.Errorf("Expected call to ThingImageRepositoryMock.GetByThingID with params: %#v", *m.GetByThingIDMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcGetByThingID != nil && afterGetByThingIDCounter < 1 {
- m.t.Error("Expected call to ThingImageRepositoryMock.GetByThingID")
- }
- if !m.GetByThingIDMock.invocationsDone() && afterGetByThingIDCounter > 0 {
- m.t.Errorf("Expected %d calls to ThingImageRepositoryMock.GetByThingID but found %d calls",
- mm_atomic.LoadUint64(&m.GetByThingIDMock.expectedInvocations), afterGetByThingIDCounter)
- }
- }
- // MinimockFinish checks that all mocked methods have been called the expected number of times
- func (m *ThingImageRepositoryMock) MinimockFinish() {
- m.finishOnce.Do(func() {
- if !m.minimockDone() {
- m.MinimockAddInspect()
- m.MinimockBeginTxInspect()
- m.MinimockCommitTxInspect()
- m.MinimockDeleteInspect()
- m.MinimockGetInspect()
- m.MinimockGetByPlaceIDInspect()
- m.MinimockGetByThingIDInspect()
- }
- })
- }
- // MinimockWait waits for all mocked methods to be called the expected number of times
- func (m *ThingImageRepositoryMock) 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 *ThingImageRepositoryMock) minimockDone() bool {
- done := true
- return done &&
- m.MinimockAddDone() &&
- m.MinimockBeginTxDone() &&
- m.MinimockCommitTxDone() &&
- m.MinimockDeleteDone() &&
- m.MinimockGetDone() &&
- m.MinimockGetByPlaceIDDone() &&
- m.MinimockGetByThingIDDone()
- }
|