12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030 |
- // Code generated by http://github.com/gojuno/minimock (v3.3.14). DO NOT EDIT.
- package mocks
- //go:generate minimock -i git.dmitriygnatenko.ru/dima/homethings/internal/api/v1/place.PlaceRepository -o place_repository_minimock.go -n PlaceRepositoryMock -p mocks
- import (
- "context"
- "sync"
- mm_atomic "sync/atomic"
- mm_time "time"
- "git.dmitriygnatenko.ru/dima/homethings/internal/models"
- "github.com/gojuno/minimock/v3"
- )
- // PlaceRepositoryMock implements place.PlaceRepository
- type PlaceRepositoryMock struct {
- t minimock.Tester
- finishOnce sync.Once
- funcAdd func(ctx context.Context, req models.AddPlaceRequest) (u1 uint64, err error)
- inspectFuncAdd func(ctx context.Context, req models.AddPlaceRequest)
- afterAddCounter uint64
- beforeAddCounter uint64
- AddMock mPlaceRepositoryMockAdd
- funcDelete func(ctx context.Context, id uint64) (err error)
- inspectFuncDelete func(ctx context.Context, id uint64)
- afterDeleteCounter uint64
- beforeDeleteCounter uint64
- DeleteMock mPlaceRepositoryMockDelete
- funcGet func(ctx context.Context, id uint64) (pp1 *models.Place, err error)
- inspectFuncGet func(ctx context.Context, id uint64)
- afterGetCounter uint64
- beforeGetCounter uint64
- GetMock mPlaceRepositoryMockGet
- funcGetAll func(ctx context.Context) (pa1 []models.Place, err error)
- inspectFuncGetAll func(ctx context.Context)
- afterGetAllCounter uint64
- beforeGetAllCounter uint64
- GetAllMock mPlaceRepositoryMockGetAll
- funcGetNestedPlaces func(ctx context.Context, id uint64) (pa1 []models.Place, err error)
- inspectFuncGetNestedPlaces func(ctx context.Context, id uint64)
- afterGetNestedPlacesCounter uint64
- beforeGetNestedPlacesCounter uint64
- GetNestedPlacesMock mPlaceRepositoryMockGetNestedPlaces
- funcUpdate func(ctx context.Context, req models.UpdatePlaceRequest) (err error)
- inspectFuncUpdate func(ctx context.Context, req models.UpdatePlaceRequest)
- afterUpdateCounter uint64
- beforeUpdateCounter uint64
- UpdateMock mPlaceRepositoryMockUpdate
- }
- // NewPlaceRepositoryMock returns a mock for place.PlaceRepository
- func NewPlaceRepositoryMock(t minimock.Tester) *PlaceRepositoryMock {
- m := &PlaceRepositoryMock{t: t}
- if controller, ok := t.(minimock.MockController); ok {
- controller.RegisterMocker(m)
- }
- m.AddMock = mPlaceRepositoryMockAdd{mock: m}
- m.AddMock.callArgs = []*PlaceRepositoryMockAddParams{}
- m.DeleteMock = mPlaceRepositoryMockDelete{mock: m}
- m.DeleteMock.callArgs = []*PlaceRepositoryMockDeleteParams{}
- m.GetMock = mPlaceRepositoryMockGet{mock: m}
- m.GetMock.callArgs = []*PlaceRepositoryMockGetParams{}
- m.GetAllMock = mPlaceRepositoryMockGetAll{mock: m}
- m.GetAllMock.callArgs = []*PlaceRepositoryMockGetAllParams{}
- m.GetNestedPlacesMock = mPlaceRepositoryMockGetNestedPlaces{mock: m}
- m.GetNestedPlacesMock.callArgs = []*PlaceRepositoryMockGetNestedPlacesParams{}
- m.UpdateMock = mPlaceRepositoryMockUpdate{mock: m}
- m.UpdateMock.callArgs = []*PlaceRepositoryMockUpdateParams{}
- t.Cleanup(m.MinimockFinish)
- return m
- }
- type mPlaceRepositoryMockAdd struct {
- optional bool
- mock *PlaceRepositoryMock
- defaultExpectation *PlaceRepositoryMockAddExpectation
- expectations []*PlaceRepositoryMockAddExpectation
- callArgs []*PlaceRepositoryMockAddParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // PlaceRepositoryMockAddExpectation specifies expectation struct of the PlaceRepository.Add
- type PlaceRepositoryMockAddExpectation struct {
- mock *PlaceRepositoryMock
- params *PlaceRepositoryMockAddParams
- paramPtrs *PlaceRepositoryMockAddParamPtrs
- results *PlaceRepositoryMockAddResults
- Counter uint64
- }
- // PlaceRepositoryMockAddParams contains parameters of the PlaceRepository.Add
- type PlaceRepositoryMockAddParams struct {
- ctx context.Context
- req models.AddPlaceRequest
- }
- // PlaceRepositoryMockAddParamPtrs contains pointers to parameters of the PlaceRepository.Add
- type PlaceRepositoryMockAddParamPtrs struct {
- ctx *context.Context
- req *models.AddPlaceRequest
- }
- // PlaceRepositoryMockAddResults contains results of the PlaceRepository.Add
- type PlaceRepositoryMockAddResults struct {
- u1 uint64
- 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 *mPlaceRepositoryMockAdd) Optional() *mPlaceRepositoryMockAdd {
- mmAdd.optional = true
- return mmAdd
- }
- // Expect sets up expected params for PlaceRepository.Add
- func (mmAdd *mPlaceRepositoryMockAdd) Expect(ctx context.Context, req models.AddPlaceRequest) *mPlaceRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.paramPtrs != nil {
- mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by ExpectParams functions")
- }
- mmAdd.defaultExpectation.params = &PlaceRepositoryMockAddParams{ctx, req}
- 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 PlaceRepository.Add
- func (mmAdd *mPlaceRepositoryMockAdd) ExpectCtxParam1(ctx context.Context) *mPlaceRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.params != nil {
- mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by Expect")
- }
- if mmAdd.defaultExpectation.paramPtrs == nil {
- mmAdd.defaultExpectation.paramPtrs = &PlaceRepositoryMockAddParamPtrs{}
- }
- mmAdd.defaultExpectation.paramPtrs.ctx = &ctx
- return mmAdd
- }
- // ExpectReqParam2 sets up expected param req for PlaceRepository.Add
- func (mmAdd *mPlaceRepositoryMockAdd) ExpectReqParam2(req models.AddPlaceRequest) *mPlaceRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.params != nil {
- mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by Expect")
- }
- if mmAdd.defaultExpectation.paramPtrs == nil {
- mmAdd.defaultExpectation.paramPtrs = &PlaceRepositoryMockAddParamPtrs{}
- }
- mmAdd.defaultExpectation.paramPtrs.req = &req
- return mmAdd
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceRepository.Add
- func (mmAdd *mPlaceRepositoryMockAdd) Inspect(f func(ctx context.Context, req models.AddPlaceRequest)) *mPlaceRepositoryMockAdd {
- if mmAdd.mock.inspectFuncAdd != nil {
- mmAdd.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.Add")
- }
- mmAdd.mock.inspectFuncAdd = f
- return mmAdd
- }
- // Return sets up results that will be returned by PlaceRepository.Add
- func (mmAdd *mPlaceRepositoryMockAdd) Return(u1 uint64, err error) *PlaceRepositoryMock {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceRepositoryMockAddExpectation{mock: mmAdd.mock}
- }
- mmAdd.defaultExpectation.results = &PlaceRepositoryMockAddResults{u1, err}
- return mmAdd.mock
- }
- // Set uses given function f to mock the PlaceRepository.Add method
- func (mmAdd *mPlaceRepositoryMockAdd) Set(f func(ctx context.Context, req models.AddPlaceRequest) (u1 uint64, err error)) *PlaceRepositoryMock {
- if mmAdd.defaultExpectation != nil {
- mmAdd.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.Add method")
- }
- if len(mmAdd.expectations) > 0 {
- mmAdd.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.Add method")
- }
- mmAdd.mock.funcAdd = f
- return mmAdd.mock
- }
- // When sets expectation for the PlaceRepository.Add which will trigger the result defined by the following
- // Then helper
- func (mmAdd *mPlaceRepositoryMockAdd) When(ctx context.Context, req models.AddPlaceRequest) *PlaceRepositoryMockAddExpectation {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by Set")
- }
- expectation := &PlaceRepositoryMockAddExpectation{
- mock: mmAdd.mock,
- params: &PlaceRepositoryMockAddParams{ctx, req},
- }
- mmAdd.expectations = append(mmAdd.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceRepository.Add return parameters for the expectation previously defined by the When method
- func (e *PlaceRepositoryMockAddExpectation) Then(u1 uint64, err error) *PlaceRepositoryMock {
- e.results = &PlaceRepositoryMockAddResults{u1, err}
- return e.mock
- }
- // Times sets number of times PlaceRepository.Add should be invoked
- func (mmAdd *mPlaceRepositoryMockAdd) Times(n uint64) *mPlaceRepositoryMockAdd {
- if n == 0 {
- mmAdd.mock.t.Fatalf("Times of PlaceRepositoryMock.Add mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmAdd.expectedInvocations, n)
- return mmAdd
- }
- func (mmAdd *mPlaceRepositoryMockAdd) 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 place.PlaceRepository
- func (mmAdd *PlaceRepositoryMock) Add(ctx context.Context, req models.AddPlaceRequest) (u1 uint64, err error) {
- mm_atomic.AddUint64(&mmAdd.beforeAddCounter, 1)
- defer mm_atomic.AddUint64(&mmAdd.afterAddCounter, 1)
- if mmAdd.inspectFuncAdd != nil {
- mmAdd.inspectFuncAdd(ctx, req)
- }
- mm_params := PlaceRepositoryMockAddParams{ctx, req}
- // 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.u1, 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 := PlaceRepositoryMockAddParams{ctx, req}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmAdd.t.Errorf("PlaceRepositoryMock.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("PlaceRepositoryMock.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))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmAdd.t.Errorf("PlaceRepositoryMock.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 PlaceRepositoryMock.Add")
- }
- return (*mm_results).u1, (*mm_results).err
- }
- if mmAdd.funcAdd != nil {
- return mmAdd.funcAdd(ctx, req)
- }
- mmAdd.t.Fatalf("Unexpected call to PlaceRepositoryMock.Add. %v %v", ctx, req)
- return
- }
- // AddAfterCounter returns a count of finished PlaceRepositoryMock.Add invocations
- func (mmAdd *PlaceRepositoryMock) AddAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
- }
- // AddBeforeCounter returns a count of PlaceRepositoryMock.Add invocations
- func (mmAdd *PlaceRepositoryMock) AddBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceRepositoryMock.Add.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmAdd *mPlaceRepositoryMockAdd) Calls() []*PlaceRepositoryMockAddParams {
- mmAdd.mutex.RLock()
- argCopy := make([]*PlaceRepositoryMockAddParams, 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 *PlaceRepositoryMock) 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 *PlaceRepositoryMock) MinimockAddInspect() {
- for _, e := range m.AddMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceRepositoryMock.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 PlaceRepositoryMock.Add")
- } else {
- m.t.Errorf("Expected call to PlaceRepositoryMock.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 PlaceRepositoryMock.Add")
- }
- if !m.AddMock.invocationsDone() && afterAddCounter > 0 {
- m.t.Errorf("Expected %d calls to PlaceRepositoryMock.Add but found %d calls",
- mm_atomic.LoadUint64(&m.AddMock.expectedInvocations), afterAddCounter)
- }
- }
- type mPlaceRepositoryMockDelete struct {
- optional bool
- mock *PlaceRepositoryMock
- defaultExpectation *PlaceRepositoryMockDeleteExpectation
- expectations []*PlaceRepositoryMockDeleteExpectation
- callArgs []*PlaceRepositoryMockDeleteParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // PlaceRepositoryMockDeleteExpectation specifies expectation struct of the PlaceRepository.Delete
- type PlaceRepositoryMockDeleteExpectation struct {
- mock *PlaceRepositoryMock
- params *PlaceRepositoryMockDeleteParams
- paramPtrs *PlaceRepositoryMockDeleteParamPtrs
- results *PlaceRepositoryMockDeleteResults
- Counter uint64
- }
- // PlaceRepositoryMockDeleteParams contains parameters of the PlaceRepository.Delete
- type PlaceRepositoryMockDeleteParams struct {
- ctx context.Context
- id uint64
- }
- // PlaceRepositoryMockDeleteParamPtrs contains pointers to parameters of the PlaceRepository.Delete
- type PlaceRepositoryMockDeleteParamPtrs struct {
- ctx *context.Context
- id *uint64
- }
- // PlaceRepositoryMockDeleteResults contains results of the PlaceRepository.Delete
- type PlaceRepositoryMockDeleteResults 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 *mPlaceRepositoryMockDelete) Optional() *mPlaceRepositoryMockDelete {
- mmDelete.optional = true
- return mmDelete
- }
- // Expect sets up expected params for PlaceRepository.Delete
- func (mmDelete *mPlaceRepositoryMockDelete) Expect(ctx context.Context, id uint64) *mPlaceRepositoryMockDelete {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &PlaceRepositoryMockDeleteExpectation{}
- }
- if mmDelete.defaultExpectation.paramPtrs != nil {
- mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by ExpectParams functions")
- }
- mmDelete.defaultExpectation.params = &PlaceRepositoryMockDeleteParams{ctx, id}
- 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 PlaceRepository.Delete
- func (mmDelete *mPlaceRepositoryMockDelete) ExpectCtxParam1(ctx context.Context) *mPlaceRepositoryMockDelete {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &PlaceRepositoryMockDeleteExpectation{}
- }
- if mmDelete.defaultExpectation.params != nil {
- mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by Expect")
- }
- if mmDelete.defaultExpectation.paramPtrs == nil {
- mmDelete.defaultExpectation.paramPtrs = &PlaceRepositoryMockDeleteParamPtrs{}
- }
- mmDelete.defaultExpectation.paramPtrs.ctx = &ctx
- return mmDelete
- }
- // ExpectIdParam2 sets up expected param id for PlaceRepository.Delete
- func (mmDelete *mPlaceRepositoryMockDelete) ExpectIdParam2(id uint64) *mPlaceRepositoryMockDelete {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &PlaceRepositoryMockDeleteExpectation{}
- }
- if mmDelete.defaultExpectation.params != nil {
- mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by Expect")
- }
- if mmDelete.defaultExpectation.paramPtrs == nil {
- mmDelete.defaultExpectation.paramPtrs = &PlaceRepositoryMockDeleteParamPtrs{}
- }
- mmDelete.defaultExpectation.paramPtrs.id = &id
- return mmDelete
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceRepository.Delete
- func (mmDelete *mPlaceRepositoryMockDelete) Inspect(f func(ctx context.Context, id uint64)) *mPlaceRepositoryMockDelete {
- if mmDelete.mock.inspectFuncDelete != nil {
- mmDelete.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.Delete")
- }
- mmDelete.mock.inspectFuncDelete = f
- return mmDelete
- }
- // Return sets up results that will be returned by PlaceRepository.Delete
- func (mmDelete *mPlaceRepositoryMockDelete) Return(err error) *PlaceRepositoryMock {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by Set")
- }
- if mmDelete.defaultExpectation == nil {
- mmDelete.defaultExpectation = &PlaceRepositoryMockDeleteExpectation{mock: mmDelete.mock}
- }
- mmDelete.defaultExpectation.results = &PlaceRepositoryMockDeleteResults{err}
- return mmDelete.mock
- }
- // Set uses given function f to mock the PlaceRepository.Delete method
- func (mmDelete *mPlaceRepositoryMockDelete) Set(f func(ctx context.Context, id uint64) (err error)) *PlaceRepositoryMock {
- if mmDelete.defaultExpectation != nil {
- mmDelete.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.Delete method")
- }
- if len(mmDelete.expectations) > 0 {
- mmDelete.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.Delete method")
- }
- mmDelete.mock.funcDelete = f
- return mmDelete.mock
- }
- // When sets expectation for the PlaceRepository.Delete which will trigger the result defined by the following
- // Then helper
- func (mmDelete *mPlaceRepositoryMockDelete) When(ctx context.Context, id uint64) *PlaceRepositoryMockDeleteExpectation {
- if mmDelete.mock.funcDelete != nil {
- mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by Set")
- }
- expectation := &PlaceRepositoryMockDeleteExpectation{
- mock: mmDelete.mock,
- params: &PlaceRepositoryMockDeleteParams{ctx, id},
- }
- mmDelete.expectations = append(mmDelete.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceRepository.Delete return parameters for the expectation previously defined by the When method
- func (e *PlaceRepositoryMockDeleteExpectation) Then(err error) *PlaceRepositoryMock {
- e.results = &PlaceRepositoryMockDeleteResults{err}
- return e.mock
- }
- // Times sets number of times PlaceRepository.Delete should be invoked
- func (mmDelete *mPlaceRepositoryMockDelete) Times(n uint64) *mPlaceRepositoryMockDelete {
- if n == 0 {
- mmDelete.mock.t.Fatalf("Times of PlaceRepositoryMock.Delete mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmDelete.expectedInvocations, n)
- return mmDelete
- }
- func (mmDelete *mPlaceRepositoryMockDelete) 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 place.PlaceRepository
- func (mmDelete *PlaceRepositoryMock) Delete(ctx context.Context, id uint64) (err error) {
- mm_atomic.AddUint64(&mmDelete.beforeDeleteCounter, 1)
- defer mm_atomic.AddUint64(&mmDelete.afterDeleteCounter, 1)
- if mmDelete.inspectFuncDelete != nil {
- mmDelete.inspectFuncDelete(ctx, id)
- }
- mm_params := PlaceRepositoryMockDeleteParams{ctx, id}
- // 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 := PlaceRepositoryMockDeleteParams{ctx, id}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmDelete.t.Errorf("PlaceRepositoryMock.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.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
- mmDelete.t.Errorf("PlaceRepositoryMock.Delete got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmDelete.t.Errorf("PlaceRepositoryMock.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 PlaceRepositoryMock.Delete")
- }
- return (*mm_results).err
- }
- if mmDelete.funcDelete != nil {
- return mmDelete.funcDelete(ctx, id)
- }
- mmDelete.t.Fatalf("Unexpected call to PlaceRepositoryMock.Delete. %v %v", ctx, id)
- return
- }
- // DeleteAfterCounter returns a count of finished PlaceRepositoryMock.Delete invocations
- func (mmDelete *PlaceRepositoryMock) DeleteAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmDelete.afterDeleteCounter)
- }
- // DeleteBeforeCounter returns a count of PlaceRepositoryMock.Delete invocations
- func (mmDelete *PlaceRepositoryMock) DeleteBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmDelete.beforeDeleteCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceRepositoryMock.Delete.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmDelete *mPlaceRepositoryMockDelete) Calls() []*PlaceRepositoryMockDeleteParams {
- mmDelete.mutex.RLock()
- argCopy := make([]*PlaceRepositoryMockDeleteParams, 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 *PlaceRepositoryMock) 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 *PlaceRepositoryMock) MinimockDeleteInspect() {
- for _, e := range m.DeleteMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceRepositoryMock.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 PlaceRepositoryMock.Delete")
- } else {
- m.t.Errorf("Expected call to PlaceRepositoryMock.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 PlaceRepositoryMock.Delete")
- }
- if !m.DeleteMock.invocationsDone() && afterDeleteCounter > 0 {
- m.t.Errorf("Expected %d calls to PlaceRepositoryMock.Delete but found %d calls",
- mm_atomic.LoadUint64(&m.DeleteMock.expectedInvocations), afterDeleteCounter)
- }
- }
- type mPlaceRepositoryMockGet struct {
- optional bool
- mock *PlaceRepositoryMock
- defaultExpectation *PlaceRepositoryMockGetExpectation
- expectations []*PlaceRepositoryMockGetExpectation
- callArgs []*PlaceRepositoryMockGetParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // PlaceRepositoryMockGetExpectation specifies expectation struct of the PlaceRepository.Get
- type PlaceRepositoryMockGetExpectation struct {
- mock *PlaceRepositoryMock
- params *PlaceRepositoryMockGetParams
- paramPtrs *PlaceRepositoryMockGetParamPtrs
- results *PlaceRepositoryMockGetResults
- Counter uint64
- }
- // PlaceRepositoryMockGetParams contains parameters of the PlaceRepository.Get
- type PlaceRepositoryMockGetParams struct {
- ctx context.Context
- id uint64
- }
- // PlaceRepositoryMockGetParamPtrs contains pointers to parameters of the PlaceRepository.Get
- type PlaceRepositoryMockGetParamPtrs struct {
- ctx *context.Context
- id *uint64
- }
- // PlaceRepositoryMockGetResults contains results of the PlaceRepository.Get
- type PlaceRepositoryMockGetResults struct {
- pp1 *models.Place
- 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 *mPlaceRepositoryMockGet) Optional() *mPlaceRepositoryMockGet {
- mmGet.optional = true
- return mmGet
- }
- // Expect sets up expected params for PlaceRepository.Get
- func (mmGet *mPlaceRepositoryMockGet) Expect(ctx context.Context, id uint64) *mPlaceRepositoryMockGet {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by Set")
- }
- if mmGet.defaultExpectation == nil {
- mmGet.defaultExpectation = &PlaceRepositoryMockGetExpectation{}
- }
- if mmGet.defaultExpectation.paramPtrs != nil {
- mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by ExpectParams functions")
- }
- mmGet.defaultExpectation.params = &PlaceRepositoryMockGetParams{ctx, id}
- 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 PlaceRepository.Get
- func (mmGet *mPlaceRepositoryMockGet) ExpectCtxParam1(ctx context.Context) *mPlaceRepositoryMockGet {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by Set")
- }
- if mmGet.defaultExpectation == nil {
- mmGet.defaultExpectation = &PlaceRepositoryMockGetExpectation{}
- }
- if mmGet.defaultExpectation.params != nil {
- mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by Expect")
- }
- if mmGet.defaultExpectation.paramPtrs == nil {
- mmGet.defaultExpectation.paramPtrs = &PlaceRepositoryMockGetParamPtrs{}
- }
- mmGet.defaultExpectation.paramPtrs.ctx = &ctx
- return mmGet
- }
- // ExpectIdParam2 sets up expected param id for PlaceRepository.Get
- func (mmGet *mPlaceRepositoryMockGet) ExpectIdParam2(id uint64) *mPlaceRepositoryMockGet {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by Set")
- }
- if mmGet.defaultExpectation == nil {
- mmGet.defaultExpectation = &PlaceRepositoryMockGetExpectation{}
- }
- if mmGet.defaultExpectation.params != nil {
- mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by Expect")
- }
- if mmGet.defaultExpectation.paramPtrs == nil {
- mmGet.defaultExpectation.paramPtrs = &PlaceRepositoryMockGetParamPtrs{}
- }
- mmGet.defaultExpectation.paramPtrs.id = &id
- return mmGet
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceRepository.Get
- func (mmGet *mPlaceRepositoryMockGet) Inspect(f func(ctx context.Context, id uint64)) *mPlaceRepositoryMockGet {
- if mmGet.mock.inspectFuncGet != nil {
- mmGet.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.Get")
- }
- mmGet.mock.inspectFuncGet = f
- return mmGet
- }
- // Return sets up results that will be returned by PlaceRepository.Get
- func (mmGet *mPlaceRepositoryMockGet) Return(pp1 *models.Place, err error) *PlaceRepositoryMock {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by Set")
- }
- if mmGet.defaultExpectation == nil {
- mmGet.defaultExpectation = &PlaceRepositoryMockGetExpectation{mock: mmGet.mock}
- }
- mmGet.defaultExpectation.results = &PlaceRepositoryMockGetResults{pp1, err}
- return mmGet.mock
- }
- // Set uses given function f to mock the PlaceRepository.Get method
- func (mmGet *mPlaceRepositoryMockGet) Set(f func(ctx context.Context, id uint64) (pp1 *models.Place, err error)) *PlaceRepositoryMock {
- if mmGet.defaultExpectation != nil {
- mmGet.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.Get method")
- }
- if len(mmGet.expectations) > 0 {
- mmGet.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.Get method")
- }
- mmGet.mock.funcGet = f
- return mmGet.mock
- }
- // When sets expectation for the PlaceRepository.Get which will trigger the result defined by the following
- // Then helper
- func (mmGet *mPlaceRepositoryMockGet) When(ctx context.Context, id uint64) *PlaceRepositoryMockGetExpectation {
- if mmGet.mock.funcGet != nil {
- mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by Set")
- }
- expectation := &PlaceRepositoryMockGetExpectation{
- mock: mmGet.mock,
- params: &PlaceRepositoryMockGetParams{ctx, id},
- }
- mmGet.expectations = append(mmGet.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceRepository.Get return parameters for the expectation previously defined by the When method
- func (e *PlaceRepositoryMockGetExpectation) Then(pp1 *models.Place, err error) *PlaceRepositoryMock {
- e.results = &PlaceRepositoryMockGetResults{pp1, err}
- return e.mock
- }
- // Times sets number of times PlaceRepository.Get should be invoked
- func (mmGet *mPlaceRepositoryMockGet) Times(n uint64) *mPlaceRepositoryMockGet {
- if n == 0 {
- mmGet.mock.t.Fatalf("Times of PlaceRepositoryMock.Get mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmGet.expectedInvocations, n)
- return mmGet
- }
- func (mmGet *mPlaceRepositoryMockGet) 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 place.PlaceRepository
- func (mmGet *PlaceRepositoryMock) Get(ctx context.Context, id uint64) (pp1 *models.Place, err error) {
- mm_atomic.AddUint64(&mmGet.beforeGetCounter, 1)
- defer mm_atomic.AddUint64(&mmGet.afterGetCounter, 1)
- if mmGet.inspectFuncGet != nil {
- mmGet.inspectFuncGet(ctx, id)
- }
- mm_params := PlaceRepositoryMockGetParams{ctx, id}
- // 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.pp1, 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 := PlaceRepositoryMockGetParams{ctx, id}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmGet.t.Errorf("PlaceRepositoryMock.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.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
- mmGet.t.Errorf("PlaceRepositoryMock.Get got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmGet.t.Errorf("PlaceRepositoryMock.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 PlaceRepositoryMock.Get")
- }
- return (*mm_results).pp1, (*mm_results).err
- }
- if mmGet.funcGet != nil {
- return mmGet.funcGet(ctx, id)
- }
- mmGet.t.Fatalf("Unexpected call to PlaceRepositoryMock.Get. %v %v", ctx, id)
- return
- }
- // GetAfterCounter returns a count of finished PlaceRepositoryMock.Get invocations
- func (mmGet *PlaceRepositoryMock) GetAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGet.afterGetCounter)
- }
- // GetBeforeCounter returns a count of PlaceRepositoryMock.Get invocations
- func (mmGet *PlaceRepositoryMock) GetBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGet.beforeGetCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceRepositoryMock.Get.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGet *mPlaceRepositoryMockGet) Calls() []*PlaceRepositoryMockGetParams {
- mmGet.mutex.RLock()
- argCopy := make([]*PlaceRepositoryMockGetParams, 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 *PlaceRepositoryMock) 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 *PlaceRepositoryMock) MinimockGetInspect() {
- for _, e := range m.GetMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceRepositoryMock.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 PlaceRepositoryMock.Get")
- } else {
- m.t.Errorf("Expected call to PlaceRepositoryMock.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 PlaceRepositoryMock.Get")
- }
- if !m.GetMock.invocationsDone() && afterGetCounter > 0 {
- m.t.Errorf("Expected %d calls to PlaceRepositoryMock.Get but found %d calls",
- mm_atomic.LoadUint64(&m.GetMock.expectedInvocations), afterGetCounter)
- }
- }
- type mPlaceRepositoryMockGetAll struct {
- optional bool
- mock *PlaceRepositoryMock
- defaultExpectation *PlaceRepositoryMockGetAllExpectation
- expectations []*PlaceRepositoryMockGetAllExpectation
- callArgs []*PlaceRepositoryMockGetAllParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // PlaceRepositoryMockGetAllExpectation specifies expectation struct of the PlaceRepository.GetAll
- type PlaceRepositoryMockGetAllExpectation struct {
- mock *PlaceRepositoryMock
- params *PlaceRepositoryMockGetAllParams
- paramPtrs *PlaceRepositoryMockGetAllParamPtrs
- results *PlaceRepositoryMockGetAllResults
- Counter uint64
- }
- // PlaceRepositoryMockGetAllParams contains parameters of the PlaceRepository.GetAll
- type PlaceRepositoryMockGetAllParams struct {
- ctx context.Context
- }
- // PlaceRepositoryMockGetAllParamPtrs contains pointers to parameters of the PlaceRepository.GetAll
- type PlaceRepositoryMockGetAllParamPtrs struct {
- ctx *context.Context
- }
- // PlaceRepositoryMockGetAllResults contains results of the PlaceRepository.GetAll
- type PlaceRepositoryMockGetAllResults struct {
- pa1 []models.Place
- 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 (mmGetAll *mPlaceRepositoryMockGetAll) Optional() *mPlaceRepositoryMockGetAll {
- mmGetAll.optional = true
- return mmGetAll
- }
- // Expect sets up expected params for PlaceRepository.GetAll
- func (mmGetAll *mPlaceRepositoryMockGetAll) Expect(ctx context.Context) *mPlaceRepositoryMockGetAll {
- if mmGetAll.mock.funcGetAll != nil {
- mmGetAll.mock.t.Fatalf("PlaceRepositoryMock.GetAll mock is already set by Set")
- }
- if mmGetAll.defaultExpectation == nil {
- mmGetAll.defaultExpectation = &PlaceRepositoryMockGetAllExpectation{}
- }
- if mmGetAll.defaultExpectation.paramPtrs != nil {
- mmGetAll.mock.t.Fatalf("PlaceRepositoryMock.GetAll mock is already set by ExpectParams functions")
- }
- mmGetAll.defaultExpectation.params = &PlaceRepositoryMockGetAllParams{ctx}
- for _, e := range mmGetAll.expectations {
- if minimock.Equal(e.params, mmGetAll.defaultExpectation.params) {
- mmGetAll.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetAll.defaultExpectation.params)
- }
- }
- return mmGetAll
- }
- // ExpectCtxParam1 sets up expected param ctx for PlaceRepository.GetAll
- func (mmGetAll *mPlaceRepositoryMockGetAll) ExpectCtxParam1(ctx context.Context) *mPlaceRepositoryMockGetAll {
- if mmGetAll.mock.funcGetAll != nil {
- mmGetAll.mock.t.Fatalf("PlaceRepositoryMock.GetAll mock is already set by Set")
- }
- if mmGetAll.defaultExpectation == nil {
- mmGetAll.defaultExpectation = &PlaceRepositoryMockGetAllExpectation{}
- }
- if mmGetAll.defaultExpectation.params != nil {
- mmGetAll.mock.t.Fatalf("PlaceRepositoryMock.GetAll mock is already set by Expect")
- }
- if mmGetAll.defaultExpectation.paramPtrs == nil {
- mmGetAll.defaultExpectation.paramPtrs = &PlaceRepositoryMockGetAllParamPtrs{}
- }
- mmGetAll.defaultExpectation.paramPtrs.ctx = &ctx
- return mmGetAll
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceRepository.GetAll
- func (mmGetAll *mPlaceRepositoryMockGetAll) Inspect(f func(ctx context.Context)) *mPlaceRepositoryMockGetAll {
- if mmGetAll.mock.inspectFuncGetAll != nil {
- mmGetAll.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.GetAll")
- }
- mmGetAll.mock.inspectFuncGetAll = f
- return mmGetAll
- }
- // Return sets up results that will be returned by PlaceRepository.GetAll
- func (mmGetAll *mPlaceRepositoryMockGetAll) Return(pa1 []models.Place, err error) *PlaceRepositoryMock {
- if mmGetAll.mock.funcGetAll != nil {
- mmGetAll.mock.t.Fatalf("PlaceRepositoryMock.GetAll mock is already set by Set")
- }
- if mmGetAll.defaultExpectation == nil {
- mmGetAll.defaultExpectation = &PlaceRepositoryMockGetAllExpectation{mock: mmGetAll.mock}
- }
- mmGetAll.defaultExpectation.results = &PlaceRepositoryMockGetAllResults{pa1, err}
- return mmGetAll.mock
- }
- // Set uses given function f to mock the PlaceRepository.GetAll method
- func (mmGetAll *mPlaceRepositoryMockGetAll) Set(f func(ctx context.Context) (pa1 []models.Place, err error)) *PlaceRepositoryMock {
- if mmGetAll.defaultExpectation != nil {
- mmGetAll.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.GetAll method")
- }
- if len(mmGetAll.expectations) > 0 {
- mmGetAll.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.GetAll method")
- }
- mmGetAll.mock.funcGetAll = f
- return mmGetAll.mock
- }
- // When sets expectation for the PlaceRepository.GetAll which will trigger the result defined by the following
- // Then helper
- func (mmGetAll *mPlaceRepositoryMockGetAll) When(ctx context.Context) *PlaceRepositoryMockGetAllExpectation {
- if mmGetAll.mock.funcGetAll != nil {
- mmGetAll.mock.t.Fatalf("PlaceRepositoryMock.GetAll mock is already set by Set")
- }
- expectation := &PlaceRepositoryMockGetAllExpectation{
- mock: mmGetAll.mock,
- params: &PlaceRepositoryMockGetAllParams{ctx},
- }
- mmGetAll.expectations = append(mmGetAll.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceRepository.GetAll return parameters for the expectation previously defined by the When method
- func (e *PlaceRepositoryMockGetAllExpectation) Then(pa1 []models.Place, err error) *PlaceRepositoryMock {
- e.results = &PlaceRepositoryMockGetAllResults{pa1, err}
- return e.mock
- }
- // Times sets number of times PlaceRepository.GetAll should be invoked
- func (mmGetAll *mPlaceRepositoryMockGetAll) Times(n uint64) *mPlaceRepositoryMockGetAll {
- if n == 0 {
- mmGetAll.mock.t.Fatalf("Times of PlaceRepositoryMock.GetAll mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmGetAll.expectedInvocations, n)
- return mmGetAll
- }
- func (mmGetAll *mPlaceRepositoryMockGetAll) invocationsDone() bool {
- if len(mmGetAll.expectations) == 0 && mmGetAll.defaultExpectation == nil && mmGetAll.mock.funcGetAll == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmGetAll.mock.afterGetAllCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmGetAll.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // GetAll implements place.PlaceRepository
- func (mmGetAll *PlaceRepositoryMock) GetAll(ctx context.Context) (pa1 []models.Place, err error) {
- mm_atomic.AddUint64(&mmGetAll.beforeGetAllCounter, 1)
- defer mm_atomic.AddUint64(&mmGetAll.afterGetAllCounter, 1)
- if mmGetAll.inspectFuncGetAll != nil {
- mmGetAll.inspectFuncGetAll(ctx)
- }
- mm_params := PlaceRepositoryMockGetAllParams{ctx}
- // Record call args
- mmGetAll.GetAllMock.mutex.Lock()
- mmGetAll.GetAllMock.callArgs = append(mmGetAll.GetAllMock.callArgs, &mm_params)
- mmGetAll.GetAllMock.mutex.Unlock()
- for _, e := range mmGetAll.GetAllMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.pa1, e.results.err
- }
- }
- if mmGetAll.GetAllMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmGetAll.GetAllMock.defaultExpectation.Counter, 1)
- mm_want := mmGetAll.GetAllMock.defaultExpectation.params
- mm_want_ptrs := mmGetAll.GetAllMock.defaultExpectation.paramPtrs
- mm_got := PlaceRepositoryMockGetAllParams{ctx}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmGetAll.t.Errorf("PlaceRepositoryMock.GetAll 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))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmGetAll.t.Errorf("PlaceRepositoryMock.GetAll got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmGetAll.GetAllMock.defaultExpectation.results
- if mm_results == nil {
- mmGetAll.t.Fatal("No results are set for the PlaceRepositoryMock.GetAll")
- }
- return (*mm_results).pa1, (*mm_results).err
- }
- if mmGetAll.funcGetAll != nil {
- return mmGetAll.funcGetAll(ctx)
- }
- mmGetAll.t.Fatalf("Unexpected call to PlaceRepositoryMock.GetAll. %v", ctx)
- return
- }
- // GetAllAfterCounter returns a count of finished PlaceRepositoryMock.GetAll invocations
- func (mmGetAll *PlaceRepositoryMock) GetAllAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetAll.afterGetAllCounter)
- }
- // GetAllBeforeCounter returns a count of PlaceRepositoryMock.GetAll invocations
- func (mmGetAll *PlaceRepositoryMock) GetAllBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetAll.beforeGetAllCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceRepositoryMock.GetAll.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGetAll *mPlaceRepositoryMockGetAll) Calls() []*PlaceRepositoryMockGetAllParams {
- mmGetAll.mutex.RLock()
- argCopy := make([]*PlaceRepositoryMockGetAllParams, len(mmGetAll.callArgs))
- copy(argCopy, mmGetAll.callArgs)
- mmGetAll.mutex.RUnlock()
- return argCopy
- }
- // MinimockGetAllDone returns true if the count of the GetAll invocations corresponds
- // the number of defined expectations
- func (m *PlaceRepositoryMock) MinimockGetAllDone() bool {
- if m.GetAllMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.GetAllMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.GetAllMock.invocationsDone()
- }
- // MinimockGetAllInspect logs each unmet expectation
- func (m *PlaceRepositoryMock) MinimockGetAllInspect() {
- for _, e := range m.GetAllMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceRepositoryMock.GetAll with params: %#v", *e.params)
- }
- }
- afterGetAllCounter := mm_atomic.LoadUint64(&m.afterGetAllCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.GetAllMock.defaultExpectation != nil && afterGetAllCounter < 1 {
- if m.GetAllMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to PlaceRepositoryMock.GetAll")
- } else {
- m.t.Errorf("Expected call to PlaceRepositoryMock.GetAll with params: %#v", *m.GetAllMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcGetAll != nil && afterGetAllCounter < 1 {
- m.t.Error("Expected call to PlaceRepositoryMock.GetAll")
- }
- if !m.GetAllMock.invocationsDone() && afterGetAllCounter > 0 {
- m.t.Errorf("Expected %d calls to PlaceRepositoryMock.GetAll but found %d calls",
- mm_atomic.LoadUint64(&m.GetAllMock.expectedInvocations), afterGetAllCounter)
- }
- }
- type mPlaceRepositoryMockGetNestedPlaces struct {
- optional bool
- mock *PlaceRepositoryMock
- defaultExpectation *PlaceRepositoryMockGetNestedPlacesExpectation
- expectations []*PlaceRepositoryMockGetNestedPlacesExpectation
- callArgs []*PlaceRepositoryMockGetNestedPlacesParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // PlaceRepositoryMockGetNestedPlacesExpectation specifies expectation struct of the PlaceRepository.GetNestedPlaces
- type PlaceRepositoryMockGetNestedPlacesExpectation struct {
- mock *PlaceRepositoryMock
- params *PlaceRepositoryMockGetNestedPlacesParams
- paramPtrs *PlaceRepositoryMockGetNestedPlacesParamPtrs
- results *PlaceRepositoryMockGetNestedPlacesResults
- Counter uint64
- }
- // PlaceRepositoryMockGetNestedPlacesParams contains parameters of the PlaceRepository.GetNestedPlaces
- type PlaceRepositoryMockGetNestedPlacesParams struct {
- ctx context.Context
- id uint64
- }
- // PlaceRepositoryMockGetNestedPlacesParamPtrs contains pointers to parameters of the PlaceRepository.GetNestedPlaces
- type PlaceRepositoryMockGetNestedPlacesParamPtrs struct {
- ctx *context.Context
- id *uint64
- }
- // PlaceRepositoryMockGetNestedPlacesResults contains results of the PlaceRepository.GetNestedPlaces
- type PlaceRepositoryMockGetNestedPlacesResults struct {
- pa1 []models.Place
- 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 (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Optional() *mPlaceRepositoryMockGetNestedPlaces {
- mmGetNestedPlaces.optional = true
- return mmGetNestedPlaces
- }
- // Expect sets up expected params for PlaceRepository.GetNestedPlaces
- func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Expect(ctx context.Context, id uint64) *mPlaceRepositoryMockGetNestedPlaces {
- if mmGetNestedPlaces.mock.funcGetNestedPlaces != nil {
- mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by Set")
- }
- if mmGetNestedPlaces.defaultExpectation == nil {
- mmGetNestedPlaces.defaultExpectation = &PlaceRepositoryMockGetNestedPlacesExpectation{}
- }
- if mmGetNestedPlaces.defaultExpectation.paramPtrs != nil {
- mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by ExpectParams functions")
- }
- mmGetNestedPlaces.defaultExpectation.params = &PlaceRepositoryMockGetNestedPlacesParams{ctx, id}
- for _, e := range mmGetNestedPlaces.expectations {
- if minimock.Equal(e.params, mmGetNestedPlaces.defaultExpectation.params) {
- mmGetNestedPlaces.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetNestedPlaces.defaultExpectation.params)
- }
- }
- return mmGetNestedPlaces
- }
- // ExpectCtxParam1 sets up expected param ctx for PlaceRepository.GetNestedPlaces
- func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) ExpectCtxParam1(ctx context.Context) *mPlaceRepositoryMockGetNestedPlaces {
- if mmGetNestedPlaces.mock.funcGetNestedPlaces != nil {
- mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by Set")
- }
- if mmGetNestedPlaces.defaultExpectation == nil {
- mmGetNestedPlaces.defaultExpectation = &PlaceRepositoryMockGetNestedPlacesExpectation{}
- }
- if mmGetNestedPlaces.defaultExpectation.params != nil {
- mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by Expect")
- }
- if mmGetNestedPlaces.defaultExpectation.paramPtrs == nil {
- mmGetNestedPlaces.defaultExpectation.paramPtrs = &PlaceRepositoryMockGetNestedPlacesParamPtrs{}
- }
- mmGetNestedPlaces.defaultExpectation.paramPtrs.ctx = &ctx
- return mmGetNestedPlaces
- }
- // ExpectIdParam2 sets up expected param id for PlaceRepository.GetNestedPlaces
- func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) ExpectIdParam2(id uint64) *mPlaceRepositoryMockGetNestedPlaces {
- if mmGetNestedPlaces.mock.funcGetNestedPlaces != nil {
- mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by Set")
- }
- if mmGetNestedPlaces.defaultExpectation == nil {
- mmGetNestedPlaces.defaultExpectation = &PlaceRepositoryMockGetNestedPlacesExpectation{}
- }
- if mmGetNestedPlaces.defaultExpectation.params != nil {
- mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by Expect")
- }
- if mmGetNestedPlaces.defaultExpectation.paramPtrs == nil {
- mmGetNestedPlaces.defaultExpectation.paramPtrs = &PlaceRepositoryMockGetNestedPlacesParamPtrs{}
- }
- mmGetNestedPlaces.defaultExpectation.paramPtrs.id = &id
- return mmGetNestedPlaces
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceRepository.GetNestedPlaces
- func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Inspect(f func(ctx context.Context, id uint64)) *mPlaceRepositoryMockGetNestedPlaces {
- if mmGetNestedPlaces.mock.inspectFuncGetNestedPlaces != nil {
- mmGetNestedPlaces.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.GetNestedPlaces")
- }
- mmGetNestedPlaces.mock.inspectFuncGetNestedPlaces = f
- return mmGetNestedPlaces
- }
- // Return sets up results that will be returned by PlaceRepository.GetNestedPlaces
- func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Return(pa1 []models.Place, err error) *PlaceRepositoryMock {
- if mmGetNestedPlaces.mock.funcGetNestedPlaces != nil {
- mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by Set")
- }
- if mmGetNestedPlaces.defaultExpectation == nil {
- mmGetNestedPlaces.defaultExpectation = &PlaceRepositoryMockGetNestedPlacesExpectation{mock: mmGetNestedPlaces.mock}
- }
- mmGetNestedPlaces.defaultExpectation.results = &PlaceRepositoryMockGetNestedPlacesResults{pa1, err}
- return mmGetNestedPlaces.mock
- }
- // Set uses given function f to mock the PlaceRepository.GetNestedPlaces method
- func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Set(f func(ctx context.Context, id uint64) (pa1 []models.Place, err error)) *PlaceRepositoryMock {
- if mmGetNestedPlaces.defaultExpectation != nil {
- mmGetNestedPlaces.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.GetNestedPlaces method")
- }
- if len(mmGetNestedPlaces.expectations) > 0 {
- mmGetNestedPlaces.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.GetNestedPlaces method")
- }
- mmGetNestedPlaces.mock.funcGetNestedPlaces = f
- return mmGetNestedPlaces.mock
- }
- // When sets expectation for the PlaceRepository.GetNestedPlaces which will trigger the result defined by the following
- // Then helper
- func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) When(ctx context.Context, id uint64) *PlaceRepositoryMockGetNestedPlacesExpectation {
- if mmGetNestedPlaces.mock.funcGetNestedPlaces != nil {
- mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by Set")
- }
- expectation := &PlaceRepositoryMockGetNestedPlacesExpectation{
- mock: mmGetNestedPlaces.mock,
- params: &PlaceRepositoryMockGetNestedPlacesParams{ctx, id},
- }
- mmGetNestedPlaces.expectations = append(mmGetNestedPlaces.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceRepository.GetNestedPlaces return parameters for the expectation previously defined by the When method
- func (e *PlaceRepositoryMockGetNestedPlacesExpectation) Then(pa1 []models.Place, err error) *PlaceRepositoryMock {
- e.results = &PlaceRepositoryMockGetNestedPlacesResults{pa1, err}
- return e.mock
- }
- // Times sets number of times PlaceRepository.GetNestedPlaces should be invoked
- func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Times(n uint64) *mPlaceRepositoryMockGetNestedPlaces {
- if n == 0 {
- mmGetNestedPlaces.mock.t.Fatalf("Times of PlaceRepositoryMock.GetNestedPlaces mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmGetNestedPlaces.expectedInvocations, n)
- return mmGetNestedPlaces
- }
- func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) invocationsDone() bool {
- if len(mmGetNestedPlaces.expectations) == 0 && mmGetNestedPlaces.defaultExpectation == nil && mmGetNestedPlaces.mock.funcGetNestedPlaces == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmGetNestedPlaces.mock.afterGetNestedPlacesCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmGetNestedPlaces.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // GetNestedPlaces implements place.PlaceRepository
- func (mmGetNestedPlaces *PlaceRepositoryMock) GetNestedPlaces(ctx context.Context, id uint64) (pa1 []models.Place, err error) {
- mm_atomic.AddUint64(&mmGetNestedPlaces.beforeGetNestedPlacesCounter, 1)
- defer mm_atomic.AddUint64(&mmGetNestedPlaces.afterGetNestedPlacesCounter, 1)
- if mmGetNestedPlaces.inspectFuncGetNestedPlaces != nil {
- mmGetNestedPlaces.inspectFuncGetNestedPlaces(ctx, id)
- }
- mm_params := PlaceRepositoryMockGetNestedPlacesParams{ctx, id}
- // Record call args
- mmGetNestedPlaces.GetNestedPlacesMock.mutex.Lock()
- mmGetNestedPlaces.GetNestedPlacesMock.callArgs = append(mmGetNestedPlaces.GetNestedPlacesMock.callArgs, &mm_params)
- mmGetNestedPlaces.GetNestedPlacesMock.mutex.Unlock()
- for _, e := range mmGetNestedPlaces.GetNestedPlacesMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.pa1, e.results.err
- }
- }
- if mmGetNestedPlaces.GetNestedPlacesMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmGetNestedPlaces.GetNestedPlacesMock.defaultExpectation.Counter, 1)
- mm_want := mmGetNestedPlaces.GetNestedPlacesMock.defaultExpectation.params
- mm_want_ptrs := mmGetNestedPlaces.GetNestedPlacesMock.defaultExpectation.paramPtrs
- mm_got := PlaceRepositoryMockGetNestedPlacesParams{ctx, id}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmGetNestedPlaces.t.Errorf("PlaceRepositoryMock.GetNestedPlaces 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.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
- mmGetNestedPlaces.t.Errorf("PlaceRepositoryMock.GetNestedPlaces got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmGetNestedPlaces.t.Errorf("PlaceRepositoryMock.GetNestedPlaces got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmGetNestedPlaces.GetNestedPlacesMock.defaultExpectation.results
- if mm_results == nil {
- mmGetNestedPlaces.t.Fatal("No results are set for the PlaceRepositoryMock.GetNestedPlaces")
- }
- return (*mm_results).pa1, (*mm_results).err
- }
- if mmGetNestedPlaces.funcGetNestedPlaces != nil {
- return mmGetNestedPlaces.funcGetNestedPlaces(ctx, id)
- }
- mmGetNestedPlaces.t.Fatalf("Unexpected call to PlaceRepositoryMock.GetNestedPlaces. %v %v", ctx, id)
- return
- }
- // GetNestedPlacesAfterCounter returns a count of finished PlaceRepositoryMock.GetNestedPlaces invocations
- func (mmGetNestedPlaces *PlaceRepositoryMock) GetNestedPlacesAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetNestedPlaces.afterGetNestedPlacesCounter)
- }
- // GetNestedPlacesBeforeCounter returns a count of PlaceRepositoryMock.GetNestedPlaces invocations
- func (mmGetNestedPlaces *PlaceRepositoryMock) GetNestedPlacesBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetNestedPlaces.beforeGetNestedPlacesCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceRepositoryMock.GetNestedPlaces.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Calls() []*PlaceRepositoryMockGetNestedPlacesParams {
- mmGetNestedPlaces.mutex.RLock()
- argCopy := make([]*PlaceRepositoryMockGetNestedPlacesParams, len(mmGetNestedPlaces.callArgs))
- copy(argCopy, mmGetNestedPlaces.callArgs)
- mmGetNestedPlaces.mutex.RUnlock()
- return argCopy
- }
- // MinimockGetNestedPlacesDone returns true if the count of the GetNestedPlaces invocations corresponds
- // the number of defined expectations
- func (m *PlaceRepositoryMock) MinimockGetNestedPlacesDone() bool {
- if m.GetNestedPlacesMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.GetNestedPlacesMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.GetNestedPlacesMock.invocationsDone()
- }
- // MinimockGetNestedPlacesInspect logs each unmet expectation
- func (m *PlaceRepositoryMock) MinimockGetNestedPlacesInspect() {
- for _, e := range m.GetNestedPlacesMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceRepositoryMock.GetNestedPlaces with params: %#v", *e.params)
- }
- }
- afterGetNestedPlacesCounter := mm_atomic.LoadUint64(&m.afterGetNestedPlacesCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.GetNestedPlacesMock.defaultExpectation != nil && afterGetNestedPlacesCounter < 1 {
- if m.GetNestedPlacesMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to PlaceRepositoryMock.GetNestedPlaces")
- } else {
- m.t.Errorf("Expected call to PlaceRepositoryMock.GetNestedPlaces with params: %#v", *m.GetNestedPlacesMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcGetNestedPlaces != nil && afterGetNestedPlacesCounter < 1 {
- m.t.Error("Expected call to PlaceRepositoryMock.GetNestedPlaces")
- }
- if !m.GetNestedPlacesMock.invocationsDone() && afterGetNestedPlacesCounter > 0 {
- m.t.Errorf("Expected %d calls to PlaceRepositoryMock.GetNestedPlaces but found %d calls",
- mm_atomic.LoadUint64(&m.GetNestedPlacesMock.expectedInvocations), afterGetNestedPlacesCounter)
- }
- }
- type mPlaceRepositoryMockUpdate struct {
- optional bool
- mock *PlaceRepositoryMock
- defaultExpectation *PlaceRepositoryMockUpdateExpectation
- expectations []*PlaceRepositoryMockUpdateExpectation
- callArgs []*PlaceRepositoryMockUpdateParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // PlaceRepositoryMockUpdateExpectation specifies expectation struct of the PlaceRepository.Update
- type PlaceRepositoryMockUpdateExpectation struct {
- mock *PlaceRepositoryMock
- params *PlaceRepositoryMockUpdateParams
- paramPtrs *PlaceRepositoryMockUpdateParamPtrs
- results *PlaceRepositoryMockUpdateResults
- Counter uint64
- }
- // PlaceRepositoryMockUpdateParams contains parameters of the PlaceRepository.Update
- type PlaceRepositoryMockUpdateParams struct {
- ctx context.Context
- req models.UpdatePlaceRequest
- }
- // PlaceRepositoryMockUpdateParamPtrs contains pointers to parameters of the PlaceRepository.Update
- type PlaceRepositoryMockUpdateParamPtrs struct {
- ctx *context.Context
- req *models.UpdatePlaceRequest
- }
- // PlaceRepositoryMockUpdateResults contains results of the PlaceRepository.Update
- type PlaceRepositoryMockUpdateResults 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 (mmUpdate *mPlaceRepositoryMockUpdate) Optional() *mPlaceRepositoryMockUpdate {
- mmUpdate.optional = true
- return mmUpdate
- }
- // Expect sets up expected params for PlaceRepository.Update
- func (mmUpdate *mPlaceRepositoryMockUpdate) Expect(ctx context.Context, req models.UpdatePlaceRequest) *mPlaceRepositoryMockUpdate {
- if mmUpdate.mock.funcUpdate != nil {
- mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by Set")
- }
- if mmUpdate.defaultExpectation == nil {
- mmUpdate.defaultExpectation = &PlaceRepositoryMockUpdateExpectation{}
- }
- if mmUpdate.defaultExpectation.paramPtrs != nil {
- mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by ExpectParams functions")
- }
- mmUpdate.defaultExpectation.params = &PlaceRepositoryMockUpdateParams{ctx, req}
- for _, e := range mmUpdate.expectations {
- if minimock.Equal(e.params, mmUpdate.defaultExpectation.params) {
- mmUpdate.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdate.defaultExpectation.params)
- }
- }
- return mmUpdate
- }
- // ExpectCtxParam1 sets up expected param ctx for PlaceRepository.Update
- func (mmUpdate *mPlaceRepositoryMockUpdate) ExpectCtxParam1(ctx context.Context) *mPlaceRepositoryMockUpdate {
- if mmUpdate.mock.funcUpdate != nil {
- mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by Set")
- }
- if mmUpdate.defaultExpectation == nil {
- mmUpdate.defaultExpectation = &PlaceRepositoryMockUpdateExpectation{}
- }
- if mmUpdate.defaultExpectation.params != nil {
- mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by Expect")
- }
- if mmUpdate.defaultExpectation.paramPtrs == nil {
- mmUpdate.defaultExpectation.paramPtrs = &PlaceRepositoryMockUpdateParamPtrs{}
- }
- mmUpdate.defaultExpectation.paramPtrs.ctx = &ctx
- return mmUpdate
- }
- // ExpectReqParam2 sets up expected param req for PlaceRepository.Update
- func (mmUpdate *mPlaceRepositoryMockUpdate) ExpectReqParam2(req models.UpdatePlaceRequest) *mPlaceRepositoryMockUpdate {
- if mmUpdate.mock.funcUpdate != nil {
- mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by Set")
- }
- if mmUpdate.defaultExpectation == nil {
- mmUpdate.defaultExpectation = &PlaceRepositoryMockUpdateExpectation{}
- }
- if mmUpdate.defaultExpectation.params != nil {
- mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by Expect")
- }
- if mmUpdate.defaultExpectation.paramPtrs == nil {
- mmUpdate.defaultExpectation.paramPtrs = &PlaceRepositoryMockUpdateParamPtrs{}
- }
- mmUpdate.defaultExpectation.paramPtrs.req = &req
- return mmUpdate
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceRepository.Update
- func (mmUpdate *mPlaceRepositoryMockUpdate) Inspect(f func(ctx context.Context, req models.UpdatePlaceRequest)) *mPlaceRepositoryMockUpdate {
- if mmUpdate.mock.inspectFuncUpdate != nil {
- mmUpdate.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.Update")
- }
- mmUpdate.mock.inspectFuncUpdate = f
- return mmUpdate
- }
- // Return sets up results that will be returned by PlaceRepository.Update
- func (mmUpdate *mPlaceRepositoryMockUpdate) Return(err error) *PlaceRepositoryMock {
- if mmUpdate.mock.funcUpdate != nil {
- mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by Set")
- }
- if mmUpdate.defaultExpectation == nil {
- mmUpdate.defaultExpectation = &PlaceRepositoryMockUpdateExpectation{mock: mmUpdate.mock}
- }
- mmUpdate.defaultExpectation.results = &PlaceRepositoryMockUpdateResults{err}
- return mmUpdate.mock
- }
- // Set uses given function f to mock the PlaceRepository.Update method
- func (mmUpdate *mPlaceRepositoryMockUpdate) Set(f func(ctx context.Context, req models.UpdatePlaceRequest) (err error)) *PlaceRepositoryMock {
- if mmUpdate.defaultExpectation != nil {
- mmUpdate.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.Update method")
- }
- if len(mmUpdate.expectations) > 0 {
- mmUpdate.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.Update method")
- }
- mmUpdate.mock.funcUpdate = f
- return mmUpdate.mock
- }
- // When sets expectation for the PlaceRepository.Update which will trigger the result defined by the following
- // Then helper
- func (mmUpdate *mPlaceRepositoryMockUpdate) When(ctx context.Context, req models.UpdatePlaceRequest) *PlaceRepositoryMockUpdateExpectation {
- if mmUpdate.mock.funcUpdate != nil {
- mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by Set")
- }
- expectation := &PlaceRepositoryMockUpdateExpectation{
- mock: mmUpdate.mock,
- params: &PlaceRepositoryMockUpdateParams{ctx, req},
- }
- mmUpdate.expectations = append(mmUpdate.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceRepository.Update return parameters for the expectation previously defined by the When method
- func (e *PlaceRepositoryMockUpdateExpectation) Then(err error) *PlaceRepositoryMock {
- e.results = &PlaceRepositoryMockUpdateResults{err}
- return e.mock
- }
- // Times sets number of times PlaceRepository.Update should be invoked
- func (mmUpdate *mPlaceRepositoryMockUpdate) Times(n uint64) *mPlaceRepositoryMockUpdate {
- if n == 0 {
- mmUpdate.mock.t.Fatalf("Times of PlaceRepositoryMock.Update mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmUpdate.expectedInvocations, n)
- return mmUpdate
- }
- func (mmUpdate *mPlaceRepositoryMockUpdate) invocationsDone() bool {
- if len(mmUpdate.expectations) == 0 && mmUpdate.defaultExpectation == nil && mmUpdate.mock.funcUpdate == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmUpdate.mock.afterUpdateCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmUpdate.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // Update implements place.PlaceRepository
- func (mmUpdate *PlaceRepositoryMock) Update(ctx context.Context, req models.UpdatePlaceRequest) (err error) {
- mm_atomic.AddUint64(&mmUpdate.beforeUpdateCounter, 1)
- defer mm_atomic.AddUint64(&mmUpdate.afterUpdateCounter, 1)
- if mmUpdate.inspectFuncUpdate != nil {
- mmUpdate.inspectFuncUpdate(ctx, req)
- }
- mm_params := PlaceRepositoryMockUpdateParams{ctx, req}
- // Record call args
- mmUpdate.UpdateMock.mutex.Lock()
- mmUpdate.UpdateMock.callArgs = append(mmUpdate.UpdateMock.callArgs, &mm_params)
- mmUpdate.UpdateMock.mutex.Unlock()
- for _, e := range mmUpdate.UpdateMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.err
- }
- }
- if mmUpdate.UpdateMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmUpdate.UpdateMock.defaultExpectation.Counter, 1)
- mm_want := mmUpdate.UpdateMock.defaultExpectation.params
- mm_want_ptrs := mmUpdate.UpdateMock.defaultExpectation.paramPtrs
- mm_got := PlaceRepositoryMockUpdateParams{ctx, req}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmUpdate.t.Errorf("PlaceRepositoryMock.Update 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) {
- mmUpdate.t.Errorf("PlaceRepositoryMock.Update 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))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmUpdate.t.Errorf("PlaceRepositoryMock.Update got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmUpdate.UpdateMock.defaultExpectation.results
- if mm_results == nil {
- mmUpdate.t.Fatal("No results are set for the PlaceRepositoryMock.Update")
- }
- return (*mm_results).err
- }
- if mmUpdate.funcUpdate != nil {
- return mmUpdate.funcUpdate(ctx, req)
- }
- mmUpdate.t.Fatalf("Unexpected call to PlaceRepositoryMock.Update. %v %v", ctx, req)
- return
- }
- // UpdateAfterCounter returns a count of finished PlaceRepositoryMock.Update invocations
- func (mmUpdate *PlaceRepositoryMock) UpdateAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmUpdate.afterUpdateCounter)
- }
- // UpdateBeforeCounter returns a count of PlaceRepositoryMock.Update invocations
- func (mmUpdate *PlaceRepositoryMock) UpdateBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmUpdate.beforeUpdateCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceRepositoryMock.Update.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmUpdate *mPlaceRepositoryMockUpdate) Calls() []*PlaceRepositoryMockUpdateParams {
- mmUpdate.mutex.RLock()
- argCopy := make([]*PlaceRepositoryMockUpdateParams, len(mmUpdate.callArgs))
- copy(argCopy, mmUpdate.callArgs)
- mmUpdate.mutex.RUnlock()
- return argCopy
- }
- // MinimockUpdateDone returns true if the count of the Update invocations corresponds
- // the number of defined expectations
- func (m *PlaceRepositoryMock) MinimockUpdateDone() bool {
- if m.UpdateMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.UpdateMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.UpdateMock.invocationsDone()
- }
- // MinimockUpdateInspect logs each unmet expectation
- func (m *PlaceRepositoryMock) MinimockUpdateInspect() {
- for _, e := range m.UpdateMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceRepositoryMock.Update with params: %#v", *e.params)
- }
- }
- afterUpdateCounter := mm_atomic.LoadUint64(&m.afterUpdateCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.UpdateMock.defaultExpectation != nil && afterUpdateCounter < 1 {
- if m.UpdateMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to PlaceRepositoryMock.Update")
- } else {
- m.t.Errorf("Expected call to PlaceRepositoryMock.Update with params: %#v", *m.UpdateMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcUpdate != nil && afterUpdateCounter < 1 {
- m.t.Error("Expected call to PlaceRepositoryMock.Update")
- }
- if !m.UpdateMock.invocationsDone() && afterUpdateCounter > 0 {
- m.t.Errorf("Expected %d calls to PlaceRepositoryMock.Update but found %d calls",
- mm_atomic.LoadUint64(&m.UpdateMock.expectedInvocations), afterUpdateCounter)
- }
- }
- // MinimockFinish checks that all mocked methods have been called the expected number of times
- func (m *PlaceRepositoryMock) MinimockFinish() {
- m.finishOnce.Do(func() {
- if !m.minimockDone() {
- m.MinimockAddInspect()
- m.MinimockDeleteInspect()
- m.MinimockGetInspect()
- m.MinimockGetAllInspect()
- m.MinimockGetNestedPlacesInspect()
- m.MinimockUpdateInspect()
- }
- })
- }
- // MinimockWait waits for all mocked methods to be called the expected number of times
- func (m *PlaceRepositoryMock) 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 *PlaceRepositoryMock) minimockDone() bool {
- done := true
- return done &&
- m.MinimockAddDone() &&
- m.MinimockDeleteDone() &&
- m.MinimockGetDone() &&
- m.MinimockGetAllDone() &&
- m.MinimockGetNestedPlacesDone() &&
- m.MinimockUpdateDone()
- }
|