123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476 |
- // 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/thing.PlaceThingRepository -o place_thing_repository_minimock.go -n PlaceThingRepositoryMock -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"
- )
- // PlaceThingRepositoryMock implements thing.PlaceThingRepository
- type PlaceThingRepositoryMock struct {
- t minimock.Tester
- finishOnce sync.Once
- funcAdd func(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx) (err error)
- inspectFuncAdd func(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx)
- afterAddCounter uint64
- beforeAddCounter uint64
- AddMock mPlaceThingRepositoryMockAdd
- funcDeleteThing func(ctx context.Context, thingID int, tx *sql.Tx) (err error)
- inspectFuncDeleteThing func(ctx context.Context, thingID int, tx *sql.Tx)
- afterDeleteThingCounter uint64
- beforeDeleteThingCounter uint64
- DeleteThingMock mPlaceThingRepositoryMockDeleteThing
- funcGetByThingID func(ctx context.Context, thingID int) (pp1 *models.PlaceThing, err error)
- inspectFuncGetByThingID func(ctx context.Context, thingID int)
- afterGetByThingIDCounter uint64
- beforeGetByThingIDCounter uint64
- GetByThingIDMock mPlaceThingRepositoryMockGetByThingID
- funcUpdatePlace func(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx) (err error)
- inspectFuncUpdatePlace func(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx)
- afterUpdatePlaceCounter uint64
- beforeUpdatePlaceCounter uint64
- UpdatePlaceMock mPlaceThingRepositoryMockUpdatePlace
- }
- // NewPlaceThingRepositoryMock returns a mock for thing.PlaceThingRepository
- func NewPlaceThingRepositoryMock(t minimock.Tester) *PlaceThingRepositoryMock {
- m := &PlaceThingRepositoryMock{t: t}
- if controller, ok := t.(minimock.MockController); ok {
- controller.RegisterMocker(m)
- }
- m.AddMock = mPlaceThingRepositoryMockAdd{mock: m}
- m.AddMock.callArgs = []*PlaceThingRepositoryMockAddParams{}
- m.DeleteThingMock = mPlaceThingRepositoryMockDeleteThing{mock: m}
- m.DeleteThingMock.callArgs = []*PlaceThingRepositoryMockDeleteThingParams{}
- m.GetByThingIDMock = mPlaceThingRepositoryMockGetByThingID{mock: m}
- m.GetByThingIDMock.callArgs = []*PlaceThingRepositoryMockGetByThingIDParams{}
- m.UpdatePlaceMock = mPlaceThingRepositoryMockUpdatePlace{mock: m}
- m.UpdatePlaceMock.callArgs = []*PlaceThingRepositoryMockUpdatePlaceParams{}
- t.Cleanup(m.MinimockFinish)
- return m
- }
- type mPlaceThingRepositoryMockAdd struct {
- optional bool
- mock *PlaceThingRepositoryMock
- defaultExpectation *PlaceThingRepositoryMockAddExpectation
- expectations []*PlaceThingRepositoryMockAddExpectation
- callArgs []*PlaceThingRepositoryMockAddParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // PlaceThingRepositoryMockAddExpectation specifies expectation struct of the PlaceThingRepository.Add
- type PlaceThingRepositoryMockAddExpectation struct {
- mock *PlaceThingRepositoryMock
- params *PlaceThingRepositoryMockAddParams
- paramPtrs *PlaceThingRepositoryMockAddParamPtrs
- results *PlaceThingRepositoryMockAddResults
- Counter uint64
- }
- // PlaceThingRepositoryMockAddParams contains parameters of the PlaceThingRepository.Add
- type PlaceThingRepositoryMockAddParams struct {
- ctx context.Context
- req models.AddPlaceThingRequest
- tx *sql.Tx
- }
- // PlaceThingRepositoryMockAddParamPtrs contains pointers to parameters of the PlaceThingRepository.Add
- type PlaceThingRepositoryMockAddParamPtrs struct {
- ctx *context.Context
- req *models.AddPlaceThingRequest
- tx **sql.Tx
- }
- // PlaceThingRepositoryMockAddResults contains results of the PlaceThingRepository.Add
- type PlaceThingRepositoryMockAddResults 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 *mPlaceThingRepositoryMockAdd) Optional() *mPlaceThingRepositoryMockAdd {
- mmAdd.optional = true
- return mmAdd
- }
- // Expect sets up expected params for PlaceThingRepository.Add
- func (mmAdd *mPlaceThingRepositoryMockAdd) Expect(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx) *mPlaceThingRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceThingRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.paramPtrs != nil {
- mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by ExpectParams functions")
- }
- mmAdd.defaultExpectation.params = &PlaceThingRepositoryMockAddParams{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 PlaceThingRepository.Add
- func (mmAdd *mPlaceThingRepositoryMockAdd) ExpectCtxParam1(ctx context.Context) *mPlaceThingRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceThingRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.params != nil {
- mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Expect")
- }
- if mmAdd.defaultExpectation.paramPtrs == nil {
- mmAdd.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockAddParamPtrs{}
- }
- mmAdd.defaultExpectation.paramPtrs.ctx = &ctx
- return mmAdd
- }
- // ExpectReqParam2 sets up expected param req for PlaceThingRepository.Add
- func (mmAdd *mPlaceThingRepositoryMockAdd) ExpectReqParam2(req models.AddPlaceThingRequest) *mPlaceThingRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceThingRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.params != nil {
- mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Expect")
- }
- if mmAdd.defaultExpectation.paramPtrs == nil {
- mmAdd.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockAddParamPtrs{}
- }
- mmAdd.defaultExpectation.paramPtrs.req = &req
- return mmAdd
- }
- // ExpectTxParam3 sets up expected param tx for PlaceThingRepository.Add
- func (mmAdd *mPlaceThingRepositoryMockAdd) ExpectTxParam3(tx *sql.Tx) *mPlaceThingRepositoryMockAdd {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceThingRepositoryMockAddExpectation{}
- }
- if mmAdd.defaultExpectation.params != nil {
- mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Expect")
- }
- if mmAdd.defaultExpectation.paramPtrs == nil {
- mmAdd.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockAddParamPtrs{}
- }
- mmAdd.defaultExpectation.paramPtrs.tx = &tx
- return mmAdd
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceThingRepository.Add
- func (mmAdd *mPlaceThingRepositoryMockAdd) Inspect(f func(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx)) *mPlaceThingRepositoryMockAdd {
- if mmAdd.mock.inspectFuncAdd != nil {
- mmAdd.mock.t.Fatalf("Inspect function is already set for PlaceThingRepositoryMock.Add")
- }
- mmAdd.mock.inspectFuncAdd = f
- return mmAdd
- }
- // Return sets up results that will be returned by PlaceThingRepository.Add
- func (mmAdd *mPlaceThingRepositoryMockAdd) Return(err error) *PlaceThingRepositoryMock {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Set")
- }
- if mmAdd.defaultExpectation == nil {
- mmAdd.defaultExpectation = &PlaceThingRepositoryMockAddExpectation{mock: mmAdd.mock}
- }
- mmAdd.defaultExpectation.results = &PlaceThingRepositoryMockAddResults{err}
- return mmAdd.mock
- }
- // Set uses given function f to mock the PlaceThingRepository.Add method
- func (mmAdd *mPlaceThingRepositoryMockAdd) Set(f func(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx) (err error)) *PlaceThingRepositoryMock {
- if mmAdd.defaultExpectation != nil {
- mmAdd.mock.t.Fatalf("Default expectation is already set for the PlaceThingRepository.Add method")
- }
- if len(mmAdd.expectations) > 0 {
- mmAdd.mock.t.Fatalf("Some expectations are already set for the PlaceThingRepository.Add method")
- }
- mmAdd.mock.funcAdd = f
- return mmAdd.mock
- }
- // When sets expectation for the PlaceThingRepository.Add which will trigger the result defined by the following
- // Then helper
- func (mmAdd *mPlaceThingRepositoryMockAdd) When(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx) *PlaceThingRepositoryMockAddExpectation {
- if mmAdd.mock.funcAdd != nil {
- mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Set")
- }
- expectation := &PlaceThingRepositoryMockAddExpectation{
- mock: mmAdd.mock,
- params: &PlaceThingRepositoryMockAddParams{ctx, req, tx},
- }
- mmAdd.expectations = append(mmAdd.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceThingRepository.Add return parameters for the expectation previously defined by the When method
- func (e *PlaceThingRepositoryMockAddExpectation) Then(err error) *PlaceThingRepositoryMock {
- e.results = &PlaceThingRepositoryMockAddResults{err}
- return e.mock
- }
- // Times sets number of times PlaceThingRepository.Add should be invoked
- func (mmAdd *mPlaceThingRepositoryMockAdd) Times(n uint64) *mPlaceThingRepositoryMockAdd {
- if n == 0 {
- mmAdd.mock.t.Fatalf("Times of PlaceThingRepositoryMock.Add mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmAdd.expectedInvocations, n)
- return mmAdd
- }
- func (mmAdd *mPlaceThingRepositoryMockAdd) 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 thing.PlaceThingRepository
- func (mmAdd *PlaceThingRepositoryMock) Add(ctx context.Context, req models.AddPlaceThingRequest, 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 := PlaceThingRepositoryMockAddParams{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 := PlaceThingRepositoryMockAddParams{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("PlaceThingRepositoryMock.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("PlaceThingRepositoryMock.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("PlaceThingRepositoryMock.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("PlaceThingRepositoryMock.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 PlaceThingRepositoryMock.Add")
- }
- return (*mm_results).err
- }
- if mmAdd.funcAdd != nil {
- return mmAdd.funcAdd(ctx, req, tx)
- }
- mmAdd.t.Fatalf("Unexpected call to PlaceThingRepositoryMock.Add. %v %v %v", ctx, req, tx)
- return
- }
- // AddAfterCounter returns a count of finished PlaceThingRepositoryMock.Add invocations
- func (mmAdd *PlaceThingRepositoryMock) AddAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
- }
- // AddBeforeCounter returns a count of PlaceThingRepositoryMock.Add invocations
- func (mmAdd *PlaceThingRepositoryMock) AddBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceThingRepositoryMock.Add.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmAdd *mPlaceThingRepositoryMockAdd) Calls() []*PlaceThingRepositoryMockAddParams {
- mmAdd.mutex.RLock()
- argCopy := make([]*PlaceThingRepositoryMockAddParams, 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 *PlaceThingRepositoryMock) 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 *PlaceThingRepositoryMock) MinimockAddInspect() {
- for _, e := range m.AddMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceThingRepositoryMock.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 PlaceThingRepositoryMock.Add")
- } else {
- m.t.Errorf("Expected call to PlaceThingRepositoryMock.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 PlaceThingRepositoryMock.Add")
- }
- if !m.AddMock.invocationsDone() && afterAddCounter > 0 {
- m.t.Errorf("Expected %d calls to PlaceThingRepositoryMock.Add but found %d calls",
- mm_atomic.LoadUint64(&m.AddMock.expectedInvocations), afterAddCounter)
- }
- }
- type mPlaceThingRepositoryMockDeleteThing struct {
- optional bool
- mock *PlaceThingRepositoryMock
- defaultExpectation *PlaceThingRepositoryMockDeleteThingExpectation
- expectations []*PlaceThingRepositoryMockDeleteThingExpectation
- callArgs []*PlaceThingRepositoryMockDeleteThingParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // PlaceThingRepositoryMockDeleteThingExpectation specifies expectation struct of the PlaceThingRepository.DeleteThing
- type PlaceThingRepositoryMockDeleteThingExpectation struct {
- mock *PlaceThingRepositoryMock
- params *PlaceThingRepositoryMockDeleteThingParams
- paramPtrs *PlaceThingRepositoryMockDeleteThingParamPtrs
- results *PlaceThingRepositoryMockDeleteThingResults
- Counter uint64
- }
- // PlaceThingRepositoryMockDeleteThingParams contains parameters of the PlaceThingRepository.DeleteThing
- type PlaceThingRepositoryMockDeleteThingParams struct {
- ctx context.Context
- thingID int
- tx *sql.Tx
- }
- // PlaceThingRepositoryMockDeleteThingParamPtrs contains pointers to parameters of the PlaceThingRepository.DeleteThing
- type PlaceThingRepositoryMockDeleteThingParamPtrs struct {
- ctx *context.Context
- thingID *int
- tx **sql.Tx
- }
- // PlaceThingRepositoryMockDeleteThingResults contains results of the PlaceThingRepository.DeleteThing
- type PlaceThingRepositoryMockDeleteThingResults 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 (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Optional() *mPlaceThingRepositoryMockDeleteThing {
- mmDeleteThing.optional = true
- return mmDeleteThing
- }
- // Expect sets up expected params for PlaceThingRepository.DeleteThing
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Expect(ctx context.Context, thingID int, tx *sql.Tx) *mPlaceThingRepositoryMockDeleteThing {
- if mmDeleteThing.mock.funcDeleteThing != nil {
- mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Set")
- }
- if mmDeleteThing.defaultExpectation == nil {
- mmDeleteThing.defaultExpectation = &PlaceThingRepositoryMockDeleteThingExpectation{}
- }
- if mmDeleteThing.defaultExpectation.paramPtrs != nil {
- mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by ExpectParams functions")
- }
- mmDeleteThing.defaultExpectation.params = &PlaceThingRepositoryMockDeleteThingParams{ctx, thingID, tx}
- for _, e := range mmDeleteThing.expectations {
- if minimock.Equal(e.params, mmDeleteThing.defaultExpectation.params) {
- mmDeleteThing.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDeleteThing.defaultExpectation.params)
- }
- }
- return mmDeleteThing
- }
- // ExpectCtxParam1 sets up expected param ctx for PlaceThingRepository.DeleteThing
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) ExpectCtxParam1(ctx context.Context) *mPlaceThingRepositoryMockDeleteThing {
- if mmDeleteThing.mock.funcDeleteThing != nil {
- mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Set")
- }
- if mmDeleteThing.defaultExpectation == nil {
- mmDeleteThing.defaultExpectation = &PlaceThingRepositoryMockDeleteThingExpectation{}
- }
- if mmDeleteThing.defaultExpectation.params != nil {
- mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Expect")
- }
- if mmDeleteThing.defaultExpectation.paramPtrs == nil {
- mmDeleteThing.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockDeleteThingParamPtrs{}
- }
- mmDeleteThing.defaultExpectation.paramPtrs.ctx = &ctx
- return mmDeleteThing
- }
- // ExpectThingIDParam2 sets up expected param thingID for PlaceThingRepository.DeleteThing
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) ExpectThingIDParam2(thingID int) *mPlaceThingRepositoryMockDeleteThing {
- if mmDeleteThing.mock.funcDeleteThing != nil {
- mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Set")
- }
- if mmDeleteThing.defaultExpectation == nil {
- mmDeleteThing.defaultExpectation = &PlaceThingRepositoryMockDeleteThingExpectation{}
- }
- if mmDeleteThing.defaultExpectation.params != nil {
- mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Expect")
- }
- if mmDeleteThing.defaultExpectation.paramPtrs == nil {
- mmDeleteThing.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockDeleteThingParamPtrs{}
- }
- mmDeleteThing.defaultExpectation.paramPtrs.thingID = &thingID
- return mmDeleteThing
- }
- // ExpectTxParam3 sets up expected param tx for PlaceThingRepository.DeleteThing
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) ExpectTxParam3(tx *sql.Tx) *mPlaceThingRepositoryMockDeleteThing {
- if mmDeleteThing.mock.funcDeleteThing != nil {
- mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Set")
- }
- if mmDeleteThing.defaultExpectation == nil {
- mmDeleteThing.defaultExpectation = &PlaceThingRepositoryMockDeleteThingExpectation{}
- }
- if mmDeleteThing.defaultExpectation.params != nil {
- mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Expect")
- }
- if mmDeleteThing.defaultExpectation.paramPtrs == nil {
- mmDeleteThing.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockDeleteThingParamPtrs{}
- }
- mmDeleteThing.defaultExpectation.paramPtrs.tx = &tx
- return mmDeleteThing
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceThingRepository.DeleteThing
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Inspect(f func(ctx context.Context, thingID int, tx *sql.Tx)) *mPlaceThingRepositoryMockDeleteThing {
- if mmDeleteThing.mock.inspectFuncDeleteThing != nil {
- mmDeleteThing.mock.t.Fatalf("Inspect function is already set for PlaceThingRepositoryMock.DeleteThing")
- }
- mmDeleteThing.mock.inspectFuncDeleteThing = f
- return mmDeleteThing
- }
- // Return sets up results that will be returned by PlaceThingRepository.DeleteThing
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Return(err error) *PlaceThingRepositoryMock {
- if mmDeleteThing.mock.funcDeleteThing != nil {
- mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Set")
- }
- if mmDeleteThing.defaultExpectation == nil {
- mmDeleteThing.defaultExpectation = &PlaceThingRepositoryMockDeleteThingExpectation{mock: mmDeleteThing.mock}
- }
- mmDeleteThing.defaultExpectation.results = &PlaceThingRepositoryMockDeleteThingResults{err}
- return mmDeleteThing.mock
- }
- // Set uses given function f to mock the PlaceThingRepository.DeleteThing method
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Set(f func(ctx context.Context, thingID int, tx *sql.Tx) (err error)) *PlaceThingRepositoryMock {
- if mmDeleteThing.defaultExpectation != nil {
- mmDeleteThing.mock.t.Fatalf("Default expectation is already set for the PlaceThingRepository.DeleteThing method")
- }
- if len(mmDeleteThing.expectations) > 0 {
- mmDeleteThing.mock.t.Fatalf("Some expectations are already set for the PlaceThingRepository.DeleteThing method")
- }
- mmDeleteThing.mock.funcDeleteThing = f
- return mmDeleteThing.mock
- }
- // When sets expectation for the PlaceThingRepository.DeleteThing which will trigger the result defined by the following
- // Then helper
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) When(ctx context.Context, thingID int, tx *sql.Tx) *PlaceThingRepositoryMockDeleteThingExpectation {
- if mmDeleteThing.mock.funcDeleteThing != nil {
- mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Set")
- }
- expectation := &PlaceThingRepositoryMockDeleteThingExpectation{
- mock: mmDeleteThing.mock,
- params: &PlaceThingRepositoryMockDeleteThingParams{ctx, thingID, tx},
- }
- mmDeleteThing.expectations = append(mmDeleteThing.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceThingRepository.DeleteThing return parameters for the expectation previously defined by the When method
- func (e *PlaceThingRepositoryMockDeleteThingExpectation) Then(err error) *PlaceThingRepositoryMock {
- e.results = &PlaceThingRepositoryMockDeleteThingResults{err}
- return e.mock
- }
- // Times sets number of times PlaceThingRepository.DeleteThing should be invoked
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Times(n uint64) *mPlaceThingRepositoryMockDeleteThing {
- if n == 0 {
- mmDeleteThing.mock.t.Fatalf("Times of PlaceThingRepositoryMock.DeleteThing mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmDeleteThing.expectedInvocations, n)
- return mmDeleteThing
- }
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) invocationsDone() bool {
- if len(mmDeleteThing.expectations) == 0 && mmDeleteThing.defaultExpectation == nil && mmDeleteThing.mock.funcDeleteThing == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmDeleteThing.mock.afterDeleteThingCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmDeleteThing.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // DeleteThing implements thing.PlaceThingRepository
- func (mmDeleteThing *PlaceThingRepositoryMock) DeleteThing(ctx context.Context, thingID int, tx *sql.Tx) (err error) {
- mm_atomic.AddUint64(&mmDeleteThing.beforeDeleteThingCounter, 1)
- defer mm_atomic.AddUint64(&mmDeleteThing.afterDeleteThingCounter, 1)
- if mmDeleteThing.inspectFuncDeleteThing != nil {
- mmDeleteThing.inspectFuncDeleteThing(ctx, thingID, tx)
- }
- mm_params := PlaceThingRepositoryMockDeleteThingParams{ctx, thingID, tx}
- // Record call args
- mmDeleteThing.DeleteThingMock.mutex.Lock()
- mmDeleteThing.DeleteThingMock.callArgs = append(mmDeleteThing.DeleteThingMock.callArgs, &mm_params)
- mmDeleteThing.DeleteThingMock.mutex.Unlock()
- for _, e := range mmDeleteThing.DeleteThingMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.err
- }
- }
- if mmDeleteThing.DeleteThingMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmDeleteThing.DeleteThingMock.defaultExpectation.Counter, 1)
- mm_want := mmDeleteThing.DeleteThingMock.defaultExpectation.params
- mm_want_ptrs := mmDeleteThing.DeleteThingMock.defaultExpectation.paramPtrs
- mm_got := PlaceThingRepositoryMockDeleteThingParams{ctx, thingID, tx}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmDeleteThing.t.Errorf("PlaceThingRepositoryMock.DeleteThing 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) {
- mmDeleteThing.t.Errorf("PlaceThingRepositoryMock.DeleteThing 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))
- }
- if mm_want_ptrs.tx != nil && !minimock.Equal(*mm_want_ptrs.tx, mm_got.tx) {
- mmDeleteThing.t.Errorf("PlaceThingRepositoryMock.DeleteThing 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) {
- mmDeleteThing.t.Errorf("PlaceThingRepositoryMock.DeleteThing got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmDeleteThing.DeleteThingMock.defaultExpectation.results
- if mm_results == nil {
- mmDeleteThing.t.Fatal("No results are set for the PlaceThingRepositoryMock.DeleteThing")
- }
- return (*mm_results).err
- }
- if mmDeleteThing.funcDeleteThing != nil {
- return mmDeleteThing.funcDeleteThing(ctx, thingID, tx)
- }
- mmDeleteThing.t.Fatalf("Unexpected call to PlaceThingRepositoryMock.DeleteThing. %v %v %v", ctx, thingID, tx)
- return
- }
- // DeleteThingAfterCounter returns a count of finished PlaceThingRepositoryMock.DeleteThing invocations
- func (mmDeleteThing *PlaceThingRepositoryMock) DeleteThingAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmDeleteThing.afterDeleteThingCounter)
- }
- // DeleteThingBeforeCounter returns a count of PlaceThingRepositoryMock.DeleteThing invocations
- func (mmDeleteThing *PlaceThingRepositoryMock) DeleteThingBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmDeleteThing.beforeDeleteThingCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceThingRepositoryMock.DeleteThing.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Calls() []*PlaceThingRepositoryMockDeleteThingParams {
- mmDeleteThing.mutex.RLock()
- argCopy := make([]*PlaceThingRepositoryMockDeleteThingParams, len(mmDeleteThing.callArgs))
- copy(argCopy, mmDeleteThing.callArgs)
- mmDeleteThing.mutex.RUnlock()
- return argCopy
- }
- // MinimockDeleteThingDone returns true if the count of the DeleteThing invocations corresponds
- // the number of defined expectations
- func (m *PlaceThingRepositoryMock) MinimockDeleteThingDone() bool {
- if m.DeleteThingMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.DeleteThingMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.DeleteThingMock.invocationsDone()
- }
- // MinimockDeleteThingInspect logs each unmet expectation
- func (m *PlaceThingRepositoryMock) MinimockDeleteThingInspect() {
- for _, e := range m.DeleteThingMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceThingRepositoryMock.DeleteThing with params: %#v", *e.params)
- }
- }
- afterDeleteThingCounter := mm_atomic.LoadUint64(&m.afterDeleteThingCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.DeleteThingMock.defaultExpectation != nil && afterDeleteThingCounter < 1 {
- if m.DeleteThingMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to PlaceThingRepositoryMock.DeleteThing")
- } else {
- m.t.Errorf("Expected call to PlaceThingRepositoryMock.DeleteThing with params: %#v", *m.DeleteThingMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcDeleteThing != nil && afterDeleteThingCounter < 1 {
- m.t.Error("Expected call to PlaceThingRepositoryMock.DeleteThing")
- }
- if !m.DeleteThingMock.invocationsDone() && afterDeleteThingCounter > 0 {
- m.t.Errorf("Expected %d calls to PlaceThingRepositoryMock.DeleteThing but found %d calls",
- mm_atomic.LoadUint64(&m.DeleteThingMock.expectedInvocations), afterDeleteThingCounter)
- }
- }
- type mPlaceThingRepositoryMockGetByThingID struct {
- optional bool
- mock *PlaceThingRepositoryMock
- defaultExpectation *PlaceThingRepositoryMockGetByThingIDExpectation
- expectations []*PlaceThingRepositoryMockGetByThingIDExpectation
- callArgs []*PlaceThingRepositoryMockGetByThingIDParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // PlaceThingRepositoryMockGetByThingIDExpectation specifies expectation struct of the PlaceThingRepository.GetByThingID
- type PlaceThingRepositoryMockGetByThingIDExpectation struct {
- mock *PlaceThingRepositoryMock
- params *PlaceThingRepositoryMockGetByThingIDParams
- paramPtrs *PlaceThingRepositoryMockGetByThingIDParamPtrs
- results *PlaceThingRepositoryMockGetByThingIDResults
- Counter uint64
- }
- // PlaceThingRepositoryMockGetByThingIDParams contains parameters of the PlaceThingRepository.GetByThingID
- type PlaceThingRepositoryMockGetByThingIDParams struct {
- ctx context.Context
- thingID int
- }
- // PlaceThingRepositoryMockGetByThingIDParamPtrs contains pointers to parameters of the PlaceThingRepository.GetByThingID
- type PlaceThingRepositoryMockGetByThingIDParamPtrs struct {
- ctx *context.Context
- thingID *int
- }
- // PlaceThingRepositoryMockGetByThingIDResults contains results of the PlaceThingRepository.GetByThingID
- type PlaceThingRepositoryMockGetByThingIDResults struct {
- pp1 *models.PlaceThing
- 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 *mPlaceThingRepositoryMockGetByThingID) Optional() *mPlaceThingRepositoryMockGetByThingID {
- mmGetByThingID.optional = true
- return mmGetByThingID
- }
- // Expect sets up expected params for PlaceThingRepository.GetByThingID
- func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Expect(ctx context.Context, thingID int) *mPlaceThingRepositoryMockGetByThingID {
- if mmGetByThingID.mock.funcGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by Set")
- }
- if mmGetByThingID.defaultExpectation == nil {
- mmGetByThingID.defaultExpectation = &PlaceThingRepositoryMockGetByThingIDExpectation{}
- }
- if mmGetByThingID.defaultExpectation.paramPtrs != nil {
- mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by ExpectParams functions")
- }
- mmGetByThingID.defaultExpectation.params = &PlaceThingRepositoryMockGetByThingIDParams{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 PlaceThingRepository.GetByThingID
- func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) ExpectCtxParam1(ctx context.Context) *mPlaceThingRepositoryMockGetByThingID {
- if mmGetByThingID.mock.funcGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by Set")
- }
- if mmGetByThingID.defaultExpectation == nil {
- mmGetByThingID.defaultExpectation = &PlaceThingRepositoryMockGetByThingIDExpectation{}
- }
- if mmGetByThingID.defaultExpectation.params != nil {
- mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by Expect")
- }
- if mmGetByThingID.defaultExpectation.paramPtrs == nil {
- mmGetByThingID.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockGetByThingIDParamPtrs{}
- }
- mmGetByThingID.defaultExpectation.paramPtrs.ctx = &ctx
- return mmGetByThingID
- }
- // ExpectThingIDParam2 sets up expected param thingID for PlaceThingRepository.GetByThingID
- func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) ExpectThingIDParam2(thingID int) *mPlaceThingRepositoryMockGetByThingID {
- if mmGetByThingID.mock.funcGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by Set")
- }
- if mmGetByThingID.defaultExpectation == nil {
- mmGetByThingID.defaultExpectation = &PlaceThingRepositoryMockGetByThingIDExpectation{}
- }
- if mmGetByThingID.defaultExpectation.params != nil {
- mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by Expect")
- }
- if mmGetByThingID.defaultExpectation.paramPtrs == nil {
- mmGetByThingID.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockGetByThingIDParamPtrs{}
- }
- mmGetByThingID.defaultExpectation.paramPtrs.thingID = &thingID
- return mmGetByThingID
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceThingRepository.GetByThingID
- func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Inspect(f func(ctx context.Context, thingID int)) *mPlaceThingRepositoryMockGetByThingID {
- if mmGetByThingID.mock.inspectFuncGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("Inspect function is already set for PlaceThingRepositoryMock.GetByThingID")
- }
- mmGetByThingID.mock.inspectFuncGetByThingID = f
- return mmGetByThingID
- }
- // Return sets up results that will be returned by PlaceThingRepository.GetByThingID
- func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Return(pp1 *models.PlaceThing, err error) *PlaceThingRepositoryMock {
- if mmGetByThingID.mock.funcGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by Set")
- }
- if mmGetByThingID.defaultExpectation == nil {
- mmGetByThingID.defaultExpectation = &PlaceThingRepositoryMockGetByThingIDExpectation{mock: mmGetByThingID.mock}
- }
- mmGetByThingID.defaultExpectation.results = &PlaceThingRepositoryMockGetByThingIDResults{pp1, err}
- return mmGetByThingID.mock
- }
- // Set uses given function f to mock the PlaceThingRepository.GetByThingID method
- func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Set(f func(ctx context.Context, thingID int) (pp1 *models.PlaceThing, err error)) *PlaceThingRepositoryMock {
- if mmGetByThingID.defaultExpectation != nil {
- mmGetByThingID.mock.t.Fatalf("Default expectation is already set for the PlaceThingRepository.GetByThingID method")
- }
- if len(mmGetByThingID.expectations) > 0 {
- mmGetByThingID.mock.t.Fatalf("Some expectations are already set for the PlaceThingRepository.GetByThingID method")
- }
- mmGetByThingID.mock.funcGetByThingID = f
- return mmGetByThingID.mock
- }
- // When sets expectation for the PlaceThingRepository.GetByThingID which will trigger the result defined by the following
- // Then helper
- func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) When(ctx context.Context, thingID int) *PlaceThingRepositoryMockGetByThingIDExpectation {
- if mmGetByThingID.mock.funcGetByThingID != nil {
- mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by Set")
- }
- expectation := &PlaceThingRepositoryMockGetByThingIDExpectation{
- mock: mmGetByThingID.mock,
- params: &PlaceThingRepositoryMockGetByThingIDParams{ctx, thingID},
- }
- mmGetByThingID.expectations = append(mmGetByThingID.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceThingRepository.GetByThingID return parameters for the expectation previously defined by the When method
- func (e *PlaceThingRepositoryMockGetByThingIDExpectation) Then(pp1 *models.PlaceThing, err error) *PlaceThingRepositoryMock {
- e.results = &PlaceThingRepositoryMockGetByThingIDResults{pp1, err}
- return e.mock
- }
- // Times sets number of times PlaceThingRepository.GetByThingID should be invoked
- func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Times(n uint64) *mPlaceThingRepositoryMockGetByThingID {
- if n == 0 {
- mmGetByThingID.mock.t.Fatalf("Times of PlaceThingRepositoryMock.GetByThingID mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmGetByThingID.expectedInvocations, n)
- return mmGetByThingID
- }
- func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) 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 thing.PlaceThingRepository
- func (mmGetByThingID *PlaceThingRepositoryMock) GetByThingID(ctx context.Context, thingID int) (pp1 *models.PlaceThing, 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 := PlaceThingRepositoryMockGetByThingIDParams{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.pp1, 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 := PlaceThingRepositoryMockGetByThingIDParams{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("PlaceThingRepositoryMock.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("PlaceThingRepositoryMock.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("PlaceThingRepositoryMock.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 PlaceThingRepositoryMock.GetByThingID")
- }
- return (*mm_results).pp1, (*mm_results).err
- }
- if mmGetByThingID.funcGetByThingID != nil {
- return mmGetByThingID.funcGetByThingID(ctx, thingID)
- }
- mmGetByThingID.t.Fatalf("Unexpected call to PlaceThingRepositoryMock.GetByThingID. %v %v", ctx, thingID)
- return
- }
- // GetByThingIDAfterCounter returns a count of finished PlaceThingRepositoryMock.GetByThingID invocations
- func (mmGetByThingID *PlaceThingRepositoryMock) GetByThingIDAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetByThingID.afterGetByThingIDCounter)
- }
- // GetByThingIDBeforeCounter returns a count of PlaceThingRepositoryMock.GetByThingID invocations
- func (mmGetByThingID *PlaceThingRepositoryMock) GetByThingIDBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetByThingID.beforeGetByThingIDCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceThingRepositoryMock.GetByThingID.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Calls() []*PlaceThingRepositoryMockGetByThingIDParams {
- mmGetByThingID.mutex.RLock()
- argCopy := make([]*PlaceThingRepositoryMockGetByThingIDParams, 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 *PlaceThingRepositoryMock) 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 *PlaceThingRepositoryMock) MinimockGetByThingIDInspect() {
- for _, e := range m.GetByThingIDMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceThingRepositoryMock.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 PlaceThingRepositoryMock.GetByThingID")
- } else {
- m.t.Errorf("Expected call to PlaceThingRepositoryMock.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 PlaceThingRepositoryMock.GetByThingID")
- }
- if !m.GetByThingIDMock.invocationsDone() && afterGetByThingIDCounter > 0 {
- m.t.Errorf("Expected %d calls to PlaceThingRepositoryMock.GetByThingID but found %d calls",
- mm_atomic.LoadUint64(&m.GetByThingIDMock.expectedInvocations), afterGetByThingIDCounter)
- }
- }
- type mPlaceThingRepositoryMockUpdatePlace struct {
- optional bool
- mock *PlaceThingRepositoryMock
- defaultExpectation *PlaceThingRepositoryMockUpdatePlaceExpectation
- expectations []*PlaceThingRepositoryMockUpdatePlaceExpectation
- callArgs []*PlaceThingRepositoryMockUpdatePlaceParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // PlaceThingRepositoryMockUpdatePlaceExpectation specifies expectation struct of the PlaceThingRepository.UpdatePlace
- type PlaceThingRepositoryMockUpdatePlaceExpectation struct {
- mock *PlaceThingRepositoryMock
- params *PlaceThingRepositoryMockUpdatePlaceParams
- paramPtrs *PlaceThingRepositoryMockUpdatePlaceParamPtrs
- results *PlaceThingRepositoryMockUpdatePlaceResults
- Counter uint64
- }
- // PlaceThingRepositoryMockUpdatePlaceParams contains parameters of the PlaceThingRepository.UpdatePlace
- type PlaceThingRepositoryMockUpdatePlaceParams struct {
- ctx context.Context
- req models.UpdatePlaceThingRequest
- tx *sql.Tx
- }
- // PlaceThingRepositoryMockUpdatePlaceParamPtrs contains pointers to parameters of the PlaceThingRepository.UpdatePlace
- type PlaceThingRepositoryMockUpdatePlaceParamPtrs struct {
- ctx *context.Context
- req *models.UpdatePlaceThingRequest
- tx **sql.Tx
- }
- // PlaceThingRepositoryMockUpdatePlaceResults contains results of the PlaceThingRepository.UpdatePlace
- type PlaceThingRepositoryMockUpdatePlaceResults 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 (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Optional() *mPlaceThingRepositoryMockUpdatePlace {
- mmUpdatePlace.optional = true
- return mmUpdatePlace
- }
- // Expect sets up expected params for PlaceThingRepository.UpdatePlace
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Expect(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx) *mPlaceThingRepositoryMockUpdatePlace {
- if mmUpdatePlace.mock.funcUpdatePlace != nil {
- mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Set")
- }
- if mmUpdatePlace.defaultExpectation == nil {
- mmUpdatePlace.defaultExpectation = &PlaceThingRepositoryMockUpdatePlaceExpectation{}
- }
- if mmUpdatePlace.defaultExpectation.paramPtrs != nil {
- mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by ExpectParams functions")
- }
- mmUpdatePlace.defaultExpectation.params = &PlaceThingRepositoryMockUpdatePlaceParams{ctx, req, tx}
- for _, e := range mmUpdatePlace.expectations {
- if minimock.Equal(e.params, mmUpdatePlace.defaultExpectation.params) {
- mmUpdatePlace.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdatePlace.defaultExpectation.params)
- }
- }
- return mmUpdatePlace
- }
- // ExpectCtxParam1 sets up expected param ctx for PlaceThingRepository.UpdatePlace
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) ExpectCtxParam1(ctx context.Context) *mPlaceThingRepositoryMockUpdatePlace {
- if mmUpdatePlace.mock.funcUpdatePlace != nil {
- mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Set")
- }
- if mmUpdatePlace.defaultExpectation == nil {
- mmUpdatePlace.defaultExpectation = &PlaceThingRepositoryMockUpdatePlaceExpectation{}
- }
- if mmUpdatePlace.defaultExpectation.params != nil {
- mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Expect")
- }
- if mmUpdatePlace.defaultExpectation.paramPtrs == nil {
- mmUpdatePlace.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockUpdatePlaceParamPtrs{}
- }
- mmUpdatePlace.defaultExpectation.paramPtrs.ctx = &ctx
- return mmUpdatePlace
- }
- // ExpectReqParam2 sets up expected param req for PlaceThingRepository.UpdatePlace
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) ExpectReqParam2(req models.UpdatePlaceThingRequest) *mPlaceThingRepositoryMockUpdatePlace {
- if mmUpdatePlace.mock.funcUpdatePlace != nil {
- mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Set")
- }
- if mmUpdatePlace.defaultExpectation == nil {
- mmUpdatePlace.defaultExpectation = &PlaceThingRepositoryMockUpdatePlaceExpectation{}
- }
- if mmUpdatePlace.defaultExpectation.params != nil {
- mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Expect")
- }
- if mmUpdatePlace.defaultExpectation.paramPtrs == nil {
- mmUpdatePlace.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockUpdatePlaceParamPtrs{}
- }
- mmUpdatePlace.defaultExpectation.paramPtrs.req = &req
- return mmUpdatePlace
- }
- // ExpectTxParam3 sets up expected param tx for PlaceThingRepository.UpdatePlace
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) ExpectTxParam3(tx *sql.Tx) *mPlaceThingRepositoryMockUpdatePlace {
- if mmUpdatePlace.mock.funcUpdatePlace != nil {
- mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Set")
- }
- if mmUpdatePlace.defaultExpectation == nil {
- mmUpdatePlace.defaultExpectation = &PlaceThingRepositoryMockUpdatePlaceExpectation{}
- }
- if mmUpdatePlace.defaultExpectation.params != nil {
- mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Expect")
- }
- if mmUpdatePlace.defaultExpectation.paramPtrs == nil {
- mmUpdatePlace.defaultExpectation.paramPtrs = &PlaceThingRepositoryMockUpdatePlaceParamPtrs{}
- }
- mmUpdatePlace.defaultExpectation.paramPtrs.tx = &tx
- return mmUpdatePlace
- }
- // Inspect accepts an inspector function that has same arguments as the PlaceThingRepository.UpdatePlace
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Inspect(f func(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx)) *mPlaceThingRepositoryMockUpdatePlace {
- if mmUpdatePlace.mock.inspectFuncUpdatePlace != nil {
- mmUpdatePlace.mock.t.Fatalf("Inspect function is already set for PlaceThingRepositoryMock.UpdatePlace")
- }
- mmUpdatePlace.mock.inspectFuncUpdatePlace = f
- return mmUpdatePlace
- }
- // Return sets up results that will be returned by PlaceThingRepository.UpdatePlace
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Return(err error) *PlaceThingRepositoryMock {
- if mmUpdatePlace.mock.funcUpdatePlace != nil {
- mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Set")
- }
- if mmUpdatePlace.defaultExpectation == nil {
- mmUpdatePlace.defaultExpectation = &PlaceThingRepositoryMockUpdatePlaceExpectation{mock: mmUpdatePlace.mock}
- }
- mmUpdatePlace.defaultExpectation.results = &PlaceThingRepositoryMockUpdatePlaceResults{err}
- return mmUpdatePlace.mock
- }
- // Set uses given function f to mock the PlaceThingRepository.UpdatePlace method
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Set(f func(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx) (err error)) *PlaceThingRepositoryMock {
- if mmUpdatePlace.defaultExpectation != nil {
- mmUpdatePlace.mock.t.Fatalf("Default expectation is already set for the PlaceThingRepository.UpdatePlace method")
- }
- if len(mmUpdatePlace.expectations) > 0 {
- mmUpdatePlace.mock.t.Fatalf("Some expectations are already set for the PlaceThingRepository.UpdatePlace method")
- }
- mmUpdatePlace.mock.funcUpdatePlace = f
- return mmUpdatePlace.mock
- }
- // When sets expectation for the PlaceThingRepository.UpdatePlace which will trigger the result defined by the following
- // Then helper
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) When(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx) *PlaceThingRepositoryMockUpdatePlaceExpectation {
- if mmUpdatePlace.mock.funcUpdatePlace != nil {
- mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Set")
- }
- expectation := &PlaceThingRepositoryMockUpdatePlaceExpectation{
- mock: mmUpdatePlace.mock,
- params: &PlaceThingRepositoryMockUpdatePlaceParams{ctx, req, tx},
- }
- mmUpdatePlace.expectations = append(mmUpdatePlace.expectations, expectation)
- return expectation
- }
- // Then sets up PlaceThingRepository.UpdatePlace return parameters for the expectation previously defined by the When method
- func (e *PlaceThingRepositoryMockUpdatePlaceExpectation) Then(err error) *PlaceThingRepositoryMock {
- e.results = &PlaceThingRepositoryMockUpdatePlaceResults{err}
- return e.mock
- }
- // Times sets number of times PlaceThingRepository.UpdatePlace should be invoked
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Times(n uint64) *mPlaceThingRepositoryMockUpdatePlace {
- if n == 0 {
- mmUpdatePlace.mock.t.Fatalf("Times of PlaceThingRepositoryMock.UpdatePlace mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmUpdatePlace.expectedInvocations, n)
- return mmUpdatePlace
- }
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) invocationsDone() bool {
- if len(mmUpdatePlace.expectations) == 0 && mmUpdatePlace.defaultExpectation == nil && mmUpdatePlace.mock.funcUpdatePlace == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmUpdatePlace.mock.afterUpdatePlaceCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmUpdatePlace.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // UpdatePlace implements thing.PlaceThingRepository
- func (mmUpdatePlace *PlaceThingRepositoryMock) UpdatePlace(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx) (err error) {
- mm_atomic.AddUint64(&mmUpdatePlace.beforeUpdatePlaceCounter, 1)
- defer mm_atomic.AddUint64(&mmUpdatePlace.afterUpdatePlaceCounter, 1)
- if mmUpdatePlace.inspectFuncUpdatePlace != nil {
- mmUpdatePlace.inspectFuncUpdatePlace(ctx, req, tx)
- }
- mm_params := PlaceThingRepositoryMockUpdatePlaceParams{ctx, req, tx}
- // Record call args
- mmUpdatePlace.UpdatePlaceMock.mutex.Lock()
- mmUpdatePlace.UpdatePlaceMock.callArgs = append(mmUpdatePlace.UpdatePlaceMock.callArgs, &mm_params)
- mmUpdatePlace.UpdatePlaceMock.mutex.Unlock()
- for _, e := range mmUpdatePlace.UpdatePlaceMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.err
- }
- }
- if mmUpdatePlace.UpdatePlaceMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmUpdatePlace.UpdatePlaceMock.defaultExpectation.Counter, 1)
- mm_want := mmUpdatePlace.UpdatePlaceMock.defaultExpectation.params
- mm_want_ptrs := mmUpdatePlace.UpdatePlaceMock.defaultExpectation.paramPtrs
- mm_got := PlaceThingRepositoryMockUpdatePlaceParams{ctx, req, tx}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
- mmUpdatePlace.t.Errorf("PlaceThingRepositoryMock.UpdatePlace 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) {
- mmUpdatePlace.t.Errorf("PlaceThingRepositoryMock.UpdatePlace 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) {
- mmUpdatePlace.t.Errorf("PlaceThingRepositoryMock.UpdatePlace 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) {
- mmUpdatePlace.t.Errorf("PlaceThingRepositoryMock.UpdatePlace got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmUpdatePlace.UpdatePlaceMock.defaultExpectation.results
- if mm_results == nil {
- mmUpdatePlace.t.Fatal("No results are set for the PlaceThingRepositoryMock.UpdatePlace")
- }
- return (*mm_results).err
- }
- if mmUpdatePlace.funcUpdatePlace != nil {
- return mmUpdatePlace.funcUpdatePlace(ctx, req, tx)
- }
- mmUpdatePlace.t.Fatalf("Unexpected call to PlaceThingRepositoryMock.UpdatePlace. %v %v %v", ctx, req, tx)
- return
- }
- // UpdatePlaceAfterCounter returns a count of finished PlaceThingRepositoryMock.UpdatePlace invocations
- func (mmUpdatePlace *PlaceThingRepositoryMock) UpdatePlaceAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmUpdatePlace.afterUpdatePlaceCounter)
- }
- // UpdatePlaceBeforeCounter returns a count of PlaceThingRepositoryMock.UpdatePlace invocations
- func (mmUpdatePlace *PlaceThingRepositoryMock) UpdatePlaceBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmUpdatePlace.beforeUpdatePlaceCounter)
- }
- // Calls returns a list of arguments used in each call to PlaceThingRepositoryMock.UpdatePlace.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Calls() []*PlaceThingRepositoryMockUpdatePlaceParams {
- mmUpdatePlace.mutex.RLock()
- argCopy := make([]*PlaceThingRepositoryMockUpdatePlaceParams, len(mmUpdatePlace.callArgs))
- copy(argCopy, mmUpdatePlace.callArgs)
- mmUpdatePlace.mutex.RUnlock()
- return argCopy
- }
- // MinimockUpdatePlaceDone returns true if the count of the UpdatePlace invocations corresponds
- // the number of defined expectations
- func (m *PlaceThingRepositoryMock) MinimockUpdatePlaceDone() bool {
- if m.UpdatePlaceMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.UpdatePlaceMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.UpdatePlaceMock.invocationsDone()
- }
- // MinimockUpdatePlaceInspect logs each unmet expectation
- func (m *PlaceThingRepositoryMock) MinimockUpdatePlaceInspect() {
- for _, e := range m.UpdatePlaceMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to PlaceThingRepositoryMock.UpdatePlace with params: %#v", *e.params)
- }
- }
- afterUpdatePlaceCounter := mm_atomic.LoadUint64(&m.afterUpdatePlaceCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.UpdatePlaceMock.defaultExpectation != nil && afterUpdatePlaceCounter < 1 {
- if m.UpdatePlaceMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to PlaceThingRepositoryMock.UpdatePlace")
- } else {
- m.t.Errorf("Expected call to PlaceThingRepositoryMock.UpdatePlace with params: %#v", *m.UpdatePlaceMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcUpdatePlace != nil && afterUpdatePlaceCounter < 1 {
- m.t.Error("Expected call to PlaceThingRepositoryMock.UpdatePlace")
- }
- if !m.UpdatePlaceMock.invocationsDone() && afterUpdatePlaceCounter > 0 {
- m.t.Errorf("Expected %d calls to PlaceThingRepositoryMock.UpdatePlace but found %d calls",
- mm_atomic.LoadUint64(&m.UpdatePlaceMock.expectedInvocations), afterUpdatePlaceCounter)
- }
- }
- // MinimockFinish checks that all mocked methods have been called the expected number of times
- func (m *PlaceThingRepositoryMock) MinimockFinish() {
- m.finishOnce.Do(func() {
- if !m.minimockDone() {
- m.MinimockAddInspect()
- m.MinimockDeleteThingInspect()
- m.MinimockGetByThingIDInspect()
- m.MinimockUpdatePlaceInspect()
- }
- })
- }
- // MinimockWait waits for all mocked methods to be called the expected number of times
- func (m *PlaceThingRepositoryMock) 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 *PlaceThingRepositoryMock) minimockDone() bool {
- done := true
- return done &&
- m.MinimockAddDone() &&
- m.MinimockDeleteThingDone() &&
- m.MinimockGetByThingIDDone() &&
- m.MinimockUpdatePlaceDone()
- }
|