place_repository_minimock.go 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888
  1. package mocks
  2. // Code generated by http://github.com/gojuno/minimock (dev). DO NOT EDIT.
  3. //go:generate minimock -i git.dmitriygnatenko.ru/dima/homethings/internal/interfaces.PlaceRepository -o ./mocks/place_repository_minimock.go -n PlaceRepositoryMock
  4. import (
  5. "context"
  6. "database/sql"
  7. "sync"
  8. mm_atomic "sync/atomic"
  9. mm_time "time"
  10. "git.dmitriygnatenko.ru/dima/homethings/internal/models"
  11. "github.com/gojuno/minimock/v3"
  12. )
  13. // PlaceRepositoryMock implements interfaces.PlaceRepository
  14. type PlaceRepositoryMock struct {
  15. t minimock.Tester
  16. funcAdd func(ctx context.Context, req models.AddPlaceRequest, tx *sql.Tx) (i1 int, err error)
  17. inspectFuncAdd func(ctx context.Context, req models.AddPlaceRequest, tx *sql.Tx)
  18. afterAddCounter uint64
  19. beforeAddCounter uint64
  20. AddMock mPlaceRepositoryMockAdd
  21. funcBeginTx func(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error)
  22. inspectFuncBeginTx func(ctx context.Context, level sql.IsolationLevel)
  23. afterBeginTxCounter uint64
  24. beforeBeginTxCounter uint64
  25. BeginTxMock mPlaceRepositoryMockBeginTx
  26. funcCommitTx func(tx *sql.Tx) (err error)
  27. inspectFuncCommitTx func(tx *sql.Tx)
  28. afterCommitTxCounter uint64
  29. beforeCommitTxCounter uint64
  30. CommitTxMock mPlaceRepositoryMockCommitTx
  31. funcDelete func(ctx context.Context, placeID int, tx *sql.Tx) (err error)
  32. inspectFuncDelete func(ctx context.Context, placeID int, tx *sql.Tx)
  33. afterDeleteCounter uint64
  34. beforeDeleteCounter uint64
  35. DeleteMock mPlaceRepositoryMockDelete
  36. funcGet func(ctx context.Context, placeID int) (pp1 *models.Place, err error)
  37. inspectFuncGet func(ctx context.Context, placeID int)
  38. afterGetCounter uint64
  39. beforeGetCounter uint64
  40. GetMock mPlaceRepositoryMockGet
  41. funcGetAll func(ctx context.Context) (pa1 []models.Place, err error)
  42. inspectFuncGetAll func(ctx context.Context)
  43. afterGetAllCounter uint64
  44. beforeGetAllCounter uint64
  45. GetAllMock mPlaceRepositoryMockGetAll
  46. funcGetNestedPlaces func(ctx context.Context, placeID int) (pa1 []models.Place, err error)
  47. inspectFuncGetNestedPlaces func(ctx context.Context, placeID int)
  48. afterGetNestedPlacesCounter uint64
  49. beforeGetNestedPlacesCounter uint64
  50. GetNestedPlacesMock mPlaceRepositoryMockGetNestedPlaces
  51. funcUpdate func(ctx context.Context, req models.UpdatePlaceRequest, tx *sql.Tx) (err error)
  52. inspectFuncUpdate func(ctx context.Context, req models.UpdatePlaceRequest, tx *sql.Tx)
  53. afterUpdateCounter uint64
  54. beforeUpdateCounter uint64
  55. UpdateMock mPlaceRepositoryMockUpdate
  56. }
  57. // NewPlaceRepositoryMock returns a mock for interfaces.PlaceRepository
  58. func NewPlaceRepositoryMock(t minimock.Tester) *PlaceRepositoryMock {
  59. m := &PlaceRepositoryMock{t: t}
  60. if controller, ok := t.(minimock.MockController); ok {
  61. controller.RegisterMocker(m)
  62. }
  63. m.AddMock = mPlaceRepositoryMockAdd{mock: m}
  64. m.AddMock.callArgs = []*PlaceRepositoryMockAddParams{}
  65. m.BeginTxMock = mPlaceRepositoryMockBeginTx{mock: m}
  66. m.BeginTxMock.callArgs = []*PlaceRepositoryMockBeginTxParams{}
  67. m.CommitTxMock = mPlaceRepositoryMockCommitTx{mock: m}
  68. m.CommitTxMock.callArgs = []*PlaceRepositoryMockCommitTxParams{}
  69. m.DeleteMock = mPlaceRepositoryMockDelete{mock: m}
  70. m.DeleteMock.callArgs = []*PlaceRepositoryMockDeleteParams{}
  71. m.GetMock = mPlaceRepositoryMockGet{mock: m}
  72. m.GetMock.callArgs = []*PlaceRepositoryMockGetParams{}
  73. m.GetAllMock = mPlaceRepositoryMockGetAll{mock: m}
  74. m.GetAllMock.callArgs = []*PlaceRepositoryMockGetAllParams{}
  75. m.GetNestedPlacesMock = mPlaceRepositoryMockGetNestedPlaces{mock: m}
  76. m.GetNestedPlacesMock.callArgs = []*PlaceRepositoryMockGetNestedPlacesParams{}
  77. m.UpdateMock = mPlaceRepositoryMockUpdate{mock: m}
  78. m.UpdateMock.callArgs = []*PlaceRepositoryMockUpdateParams{}
  79. return m
  80. }
  81. type mPlaceRepositoryMockAdd struct {
  82. mock *PlaceRepositoryMock
  83. defaultExpectation *PlaceRepositoryMockAddExpectation
  84. expectations []*PlaceRepositoryMockAddExpectation
  85. callArgs []*PlaceRepositoryMockAddParams
  86. mutex sync.RWMutex
  87. }
  88. // PlaceRepositoryMockAddExpectation specifies expectation struct of the PlaceRepository.Add
  89. type PlaceRepositoryMockAddExpectation struct {
  90. mock *PlaceRepositoryMock
  91. params *PlaceRepositoryMockAddParams
  92. results *PlaceRepositoryMockAddResults
  93. Counter uint64
  94. }
  95. // PlaceRepositoryMockAddParams contains parameters of the PlaceRepository.Add
  96. type PlaceRepositoryMockAddParams struct {
  97. ctx context.Context
  98. req models.AddPlaceRequest
  99. tx *sql.Tx
  100. }
  101. // PlaceRepositoryMockAddResults contains results of the PlaceRepository.Add
  102. type PlaceRepositoryMockAddResults struct {
  103. i1 int
  104. err error
  105. }
  106. // Expect sets up expected params for PlaceRepository.Add
  107. func (mmAdd *mPlaceRepositoryMockAdd) Expect(ctx context.Context, req models.AddPlaceRequest, tx *sql.Tx) *mPlaceRepositoryMockAdd {
  108. if mmAdd.mock.funcAdd != nil {
  109. mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by Set")
  110. }
  111. if mmAdd.defaultExpectation == nil {
  112. mmAdd.defaultExpectation = &PlaceRepositoryMockAddExpectation{}
  113. }
  114. mmAdd.defaultExpectation.params = &PlaceRepositoryMockAddParams{ctx, req, tx}
  115. for _, e := range mmAdd.expectations {
  116. if minimock.Equal(e.params, mmAdd.defaultExpectation.params) {
  117. mmAdd.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmAdd.defaultExpectation.params)
  118. }
  119. }
  120. return mmAdd
  121. }
  122. // Inspect accepts an inspector function that has same arguments as the PlaceRepository.Add
  123. func (mmAdd *mPlaceRepositoryMockAdd) Inspect(f func(ctx context.Context, req models.AddPlaceRequest, tx *sql.Tx)) *mPlaceRepositoryMockAdd {
  124. if mmAdd.mock.inspectFuncAdd != nil {
  125. mmAdd.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.Add")
  126. }
  127. mmAdd.mock.inspectFuncAdd = f
  128. return mmAdd
  129. }
  130. // Return sets up results that will be returned by PlaceRepository.Add
  131. func (mmAdd *mPlaceRepositoryMockAdd) Return(i1 int, err error) *PlaceRepositoryMock {
  132. if mmAdd.mock.funcAdd != nil {
  133. mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by Set")
  134. }
  135. if mmAdd.defaultExpectation == nil {
  136. mmAdd.defaultExpectation = &PlaceRepositoryMockAddExpectation{mock: mmAdd.mock}
  137. }
  138. mmAdd.defaultExpectation.results = &PlaceRepositoryMockAddResults{i1, err}
  139. return mmAdd.mock
  140. }
  141. // Set uses given function f to mock the PlaceRepository.Add method
  142. func (mmAdd *mPlaceRepositoryMockAdd) Set(f func(ctx context.Context, req models.AddPlaceRequest, tx *sql.Tx) (i1 int, err error)) *PlaceRepositoryMock {
  143. if mmAdd.defaultExpectation != nil {
  144. mmAdd.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.Add method")
  145. }
  146. if len(mmAdd.expectations) > 0 {
  147. mmAdd.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.Add method")
  148. }
  149. mmAdd.mock.funcAdd = f
  150. return mmAdd.mock
  151. }
  152. // When sets expectation for the PlaceRepository.Add which will trigger the result defined by the following
  153. // Then helper
  154. func (mmAdd *mPlaceRepositoryMockAdd) When(ctx context.Context, req models.AddPlaceRequest, tx *sql.Tx) *PlaceRepositoryMockAddExpectation {
  155. if mmAdd.mock.funcAdd != nil {
  156. mmAdd.mock.t.Fatalf("PlaceRepositoryMock.Add mock is already set by Set")
  157. }
  158. expectation := &PlaceRepositoryMockAddExpectation{
  159. mock: mmAdd.mock,
  160. params: &PlaceRepositoryMockAddParams{ctx, req, tx},
  161. }
  162. mmAdd.expectations = append(mmAdd.expectations, expectation)
  163. return expectation
  164. }
  165. // Then sets up PlaceRepository.Add return parameters for the expectation previously defined by the When method
  166. func (e *PlaceRepositoryMockAddExpectation) Then(i1 int, err error) *PlaceRepositoryMock {
  167. e.results = &PlaceRepositoryMockAddResults{i1, err}
  168. return e.mock
  169. }
  170. // Add implements interfaces.PlaceRepository
  171. func (mmAdd *PlaceRepositoryMock) Add(ctx context.Context, req models.AddPlaceRequest, tx *sql.Tx) (i1 int, err error) {
  172. mm_atomic.AddUint64(&mmAdd.beforeAddCounter, 1)
  173. defer mm_atomic.AddUint64(&mmAdd.afterAddCounter, 1)
  174. if mmAdd.inspectFuncAdd != nil {
  175. mmAdd.inspectFuncAdd(ctx, req, tx)
  176. }
  177. mm_params := &PlaceRepositoryMockAddParams{ctx, req, tx}
  178. // Record call args
  179. mmAdd.AddMock.mutex.Lock()
  180. mmAdd.AddMock.callArgs = append(mmAdd.AddMock.callArgs, mm_params)
  181. mmAdd.AddMock.mutex.Unlock()
  182. for _, e := range mmAdd.AddMock.expectations {
  183. if minimock.Equal(e.params, mm_params) {
  184. mm_atomic.AddUint64(&e.Counter, 1)
  185. return e.results.i1, e.results.err
  186. }
  187. }
  188. if mmAdd.AddMock.defaultExpectation != nil {
  189. mm_atomic.AddUint64(&mmAdd.AddMock.defaultExpectation.Counter, 1)
  190. mm_want := mmAdd.AddMock.defaultExpectation.params
  191. mm_got := PlaceRepositoryMockAddParams{ctx, req, tx}
  192. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  193. mmAdd.t.Errorf("PlaceRepositoryMock.Add got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  194. }
  195. mm_results := mmAdd.AddMock.defaultExpectation.results
  196. if mm_results == nil {
  197. mmAdd.t.Fatal("No results are set for the PlaceRepositoryMock.Add")
  198. }
  199. return (*mm_results).i1, (*mm_results).err
  200. }
  201. if mmAdd.funcAdd != nil {
  202. return mmAdd.funcAdd(ctx, req, tx)
  203. }
  204. mmAdd.t.Fatalf("Unexpected call to PlaceRepositoryMock.Add. %v %v %v", ctx, req, tx)
  205. return
  206. }
  207. // AddAfterCounter returns a count of finished PlaceRepositoryMock.Add invocations
  208. func (mmAdd *PlaceRepositoryMock) AddAfterCounter() uint64 {
  209. return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
  210. }
  211. // AddBeforeCounter returns a count of PlaceRepositoryMock.Add invocations
  212. func (mmAdd *PlaceRepositoryMock) AddBeforeCounter() uint64 {
  213. return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
  214. }
  215. // Calls returns a list of arguments used in each call to PlaceRepositoryMock.Add.
  216. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  217. func (mmAdd *mPlaceRepositoryMockAdd) Calls() []*PlaceRepositoryMockAddParams {
  218. mmAdd.mutex.RLock()
  219. argCopy := make([]*PlaceRepositoryMockAddParams, len(mmAdd.callArgs))
  220. copy(argCopy, mmAdd.callArgs)
  221. mmAdd.mutex.RUnlock()
  222. return argCopy
  223. }
  224. // MinimockAddDone returns true if the count of the Add invocations corresponds
  225. // the number of defined expectations
  226. func (m *PlaceRepositoryMock) MinimockAddDone() bool {
  227. for _, e := range m.AddMock.expectations {
  228. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  229. return false
  230. }
  231. }
  232. // if default expectation was set then invocations count should be greater than zero
  233. if m.AddMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
  234. return false
  235. }
  236. // if func was set then invocations count should be greater than zero
  237. if m.funcAdd != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
  238. return false
  239. }
  240. return true
  241. }
  242. // MinimockAddInspect logs each unmet expectation
  243. func (m *PlaceRepositoryMock) MinimockAddInspect() {
  244. for _, e := range m.AddMock.expectations {
  245. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  246. m.t.Errorf("Expected call to PlaceRepositoryMock.Add with params: %#v", *e.params)
  247. }
  248. }
  249. // if default expectation was set then invocations count should be greater than zero
  250. if m.AddMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
  251. if m.AddMock.defaultExpectation.params == nil {
  252. m.t.Error("Expected call to PlaceRepositoryMock.Add")
  253. } else {
  254. m.t.Errorf("Expected call to PlaceRepositoryMock.Add with params: %#v", *m.AddMock.defaultExpectation.params)
  255. }
  256. }
  257. // if func was set then invocations count should be greater than zero
  258. if m.funcAdd != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
  259. m.t.Error("Expected call to PlaceRepositoryMock.Add")
  260. }
  261. }
  262. type mPlaceRepositoryMockBeginTx struct {
  263. mock *PlaceRepositoryMock
  264. defaultExpectation *PlaceRepositoryMockBeginTxExpectation
  265. expectations []*PlaceRepositoryMockBeginTxExpectation
  266. callArgs []*PlaceRepositoryMockBeginTxParams
  267. mutex sync.RWMutex
  268. }
  269. // PlaceRepositoryMockBeginTxExpectation specifies expectation struct of the PlaceRepository.BeginTx
  270. type PlaceRepositoryMockBeginTxExpectation struct {
  271. mock *PlaceRepositoryMock
  272. params *PlaceRepositoryMockBeginTxParams
  273. results *PlaceRepositoryMockBeginTxResults
  274. Counter uint64
  275. }
  276. // PlaceRepositoryMockBeginTxParams contains parameters of the PlaceRepository.BeginTx
  277. type PlaceRepositoryMockBeginTxParams struct {
  278. ctx context.Context
  279. level sql.IsolationLevel
  280. }
  281. // PlaceRepositoryMockBeginTxResults contains results of the PlaceRepository.BeginTx
  282. type PlaceRepositoryMockBeginTxResults struct {
  283. tp1 *sql.Tx
  284. err error
  285. }
  286. // Expect sets up expected params for PlaceRepository.BeginTx
  287. func (mmBeginTx *mPlaceRepositoryMockBeginTx) Expect(ctx context.Context, level sql.IsolationLevel) *mPlaceRepositoryMockBeginTx {
  288. if mmBeginTx.mock.funcBeginTx != nil {
  289. mmBeginTx.mock.t.Fatalf("PlaceRepositoryMock.BeginTx mock is already set by Set")
  290. }
  291. if mmBeginTx.defaultExpectation == nil {
  292. mmBeginTx.defaultExpectation = &PlaceRepositoryMockBeginTxExpectation{}
  293. }
  294. mmBeginTx.defaultExpectation.params = &PlaceRepositoryMockBeginTxParams{ctx, level}
  295. for _, e := range mmBeginTx.expectations {
  296. if minimock.Equal(e.params, mmBeginTx.defaultExpectation.params) {
  297. mmBeginTx.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmBeginTx.defaultExpectation.params)
  298. }
  299. }
  300. return mmBeginTx
  301. }
  302. // Inspect accepts an inspector function that has same arguments as the PlaceRepository.BeginTx
  303. func (mmBeginTx *mPlaceRepositoryMockBeginTx) Inspect(f func(ctx context.Context, level sql.IsolationLevel)) *mPlaceRepositoryMockBeginTx {
  304. if mmBeginTx.mock.inspectFuncBeginTx != nil {
  305. mmBeginTx.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.BeginTx")
  306. }
  307. mmBeginTx.mock.inspectFuncBeginTx = f
  308. return mmBeginTx
  309. }
  310. // Return sets up results that will be returned by PlaceRepository.BeginTx
  311. func (mmBeginTx *mPlaceRepositoryMockBeginTx) Return(tp1 *sql.Tx, err error) *PlaceRepositoryMock {
  312. if mmBeginTx.mock.funcBeginTx != nil {
  313. mmBeginTx.mock.t.Fatalf("PlaceRepositoryMock.BeginTx mock is already set by Set")
  314. }
  315. if mmBeginTx.defaultExpectation == nil {
  316. mmBeginTx.defaultExpectation = &PlaceRepositoryMockBeginTxExpectation{mock: mmBeginTx.mock}
  317. }
  318. mmBeginTx.defaultExpectation.results = &PlaceRepositoryMockBeginTxResults{tp1, err}
  319. return mmBeginTx.mock
  320. }
  321. // Set uses given function f to mock the PlaceRepository.BeginTx method
  322. func (mmBeginTx *mPlaceRepositoryMockBeginTx) Set(f func(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error)) *PlaceRepositoryMock {
  323. if mmBeginTx.defaultExpectation != nil {
  324. mmBeginTx.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.BeginTx method")
  325. }
  326. if len(mmBeginTx.expectations) > 0 {
  327. mmBeginTx.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.BeginTx method")
  328. }
  329. mmBeginTx.mock.funcBeginTx = f
  330. return mmBeginTx.mock
  331. }
  332. // When sets expectation for the PlaceRepository.BeginTx which will trigger the result defined by the following
  333. // Then helper
  334. func (mmBeginTx *mPlaceRepositoryMockBeginTx) When(ctx context.Context, level sql.IsolationLevel) *PlaceRepositoryMockBeginTxExpectation {
  335. if mmBeginTx.mock.funcBeginTx != nil {
  336. mmBeginTx.mock.t.Fatalf("PlaceRepositoryMock.BeginTx mock is already set by Set")
  337. }
  338. expectation := &PlaceRepositoryMockBeginTxExpectation{
  339. mock: mmBeginTx.mock,
  340. params: &PlaceRepositoryMockBeginTxParams{ctx, level},
  341. }
  342. mmBeginTx.expectations = append(mmBeginTx.expectations, expectation)
  343. return expectation
  344. }
  345. // Then sets up PlaceRepository.BeginTx return parameters for the expectation previously defined by the When method
  346. func (e *PlaceRepositoryMockBeginTxExpectation) Then(tp1 *sql.Tx, err error) *PlaceRepositoryMock {
  347. e.results = &PlaceRepositoryMockBeginTxResults{tp1, err}
  348. return e.mock
  349. }
  350. // BeginTx implements interfaces.PlaceRepository
  351. func (mmBeginTx *PlaceRepositoryMock) BeginTx(ctx context.Context, level sql.IsolationLevel) (tp1 *sql.Tx, err error) {
  352. mm_atomic.AddUint64(&mmBeginTx.beforeBeginTxCounter, 1)
  353. defer mm_atomic.AddUint64(&mmBeginTx.afterBeginTxCounter, 1)
  354. if mmBeginTx.inspectFuncBeginTx != nil {
  355. mmBeginTx.inspectFuncBeginTx(ctx, level)
  356. }
  357. mm_params := &PlaceRepositoryMockBeginTxParams{ctx, level}
  358. // Record call args
  359. mmBeginTx.BeginTxMock.mutex.Lock()
  360. mmBeginTx.BeginTxMock.callArgs = append(mmBeginTx.BeginTxMock.callArgs, mm_params)
  361. mmBeginTx.BeginTxMock.mutex.Unlock()
  362. for _, e := range mmBeginTx.BeginTxMock.expectations {
  363. if minimock.Equal(e.params, mm_params) {
  364. mm_atomic.AddUint64(&e.Counter, 1)
  365. return e.results.tp1, e.results.err
  366. }
  367. }
  368. if mmBeginTx.BeginTxMock.defaultExpectation != nil {
  369. mm_atomic.AddUint64(&mmBeginTx.BeginTxMock.defaultExpectation.Counter, 1)
  370. mm_want := mmBeginTx.BeginTxMock.defaultExpectation.params
  371. mm_got := PlaceRepositoryMockBeginTxParams{ctx, level}
  372. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  373. mmBeginTx.t.Errorf("PlaceRepositoryMock.BeginTx got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  374. }
  375. mm_results := mmBeginTx.BeginTxMock.defaultExpectation.results
  376. if mm_results == nil {
  377. mmBeginTx.t.Fatal("No results are set for the PlaceRepositoryMock.BeginTx")
  378. }
  379. return (*mm_results).tp1, (*mm_results).err
  380. }
  381. if mmBeginTx.funcBeginTx != nil {
  382. return mmBeginTx.funcBeginTx(ctx, level)
  383. }
  384. mmBeginTx.t.Fatalf("Unexpected call to PlaceRepositoryMock.BeginTx. %v %v", ctx, level)
  385. return
  386. }
  387. // BeginTxAfterCounter returns a count of finished PlaceRepositoryMock.BeginTx invocations
  388. func (mmBeginTx *PlaceRepositoryMock) BeginTxAfterCounter() uint64 {
  389. return mm_atomic.LoadUint64(&mmBeginTx.afterBeginTxCounter)
  390. }
  391. // BeginTxBeforeCounter returns a count of PlaceRepositoryMock.BeginTx invocations
  392. func (mmBeginTx *PlaceRepositoryMock) BeginTxBeforeCounter() uint64 {
  393. return mm_atomic.LoadUint64(&mmBeginTx.beforeBeginTxCounter)
  394. }
  395. // Calls returns a list of arguments used in each call to PlaceRepositoryMock.BeginTx.
  396. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  397. func (mmBeginTx *mPlaceRepositoryMockBeginTx) Calls() []*PlaceRepositoryMockBeginTxParams {
  398. mmBeginTx.mutex.RLock()
  399. argCopy := make([]*PlaceRepositoryMockBeginTxParams, len(mmBeginTx.callArgs))
  400. copy(argCopy, mmBeginTx.callArgs)
  401. mmBeginTx.mutex.RUnlock()
  402. return argCopy
  403. }
  404. // MinimockBeginTxDone returns true if the count of the BeginTx invocations corresponds
  405. // the number of defined expectations
  406. func (m *PlaceRepositoryMock) MinimockBeginTxDone() bool {
  407. for _, e := range m.BeginTxMock.expectations {
  408. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  409. return false
  410. }
  411. }
  412. // if default expectation was set then invocations count should be greater than zero
  413. if m.BeginTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
  414. return false
  415. }
  416. // if func was set then invocations count should be greater than zero
  417. if m.funcBeginTx != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
  418. return false
  419. }
  420. return true
  421. }
  422. // MinimockBeginTxInspect logs each unmet expectation
  423. func (m *PlaceRepositoryMock) MinimockBeginTxInspect() {
  424. for _, e := range m.BeginTxMock.expectations {
  425. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  426. m.t.Errorf("Expected call to PlaceRepositoryMock.BeginTx with params: %#v", *e.params)
  427. }
  428. }
  429. // if default expectation was set then invocations count should be greater than zero
  430. if m.BeginTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
  431. if m.BeginTxMock.defaultExpectation.params == nil {
  432. m.t.Error("Expected call to PlaceRepositoryMock.BeginTx")
  433. } else {
  434. m.t.Errorf("Expected call to PlaceRepositoryMock.BeginTx with params: %#v", *m.BeginTxMock.defaultExpectation.params)
  435. }
  436. }
  437. // if func was set then invocations count should be greater than zero
  438. if m.funcBeginTx != nil && mm_atomic.LoadUint64(&m.afterBeginTxCounter) < 1 {
  439. m.t.Error("Expected call to PlaceRepositoryMock.BeginTx")
  440. }
  441. }
  442. type mPlaceRepositoryMockCommitTx struct {
  443. mock *PlaceRepositoryMock
  444. defaultExpectation *PlaceRepositoryMockCommitTxExpectation
  445. expectations []*PlaceRepositoryMockCommitTxExpectation
  446. callArgs []*PlaceRepositoryMockCommitTxParams
  447. mutex sync.RWMutex
  448. }
  449. // PlaceRepositoryMockCommitTxExpectation specifies expectation struct of the PlaceRepository.CommitTx
  450. type PlaceRepositoryMockCommitTxExpectation struct {
  451. mock *PlaceRepositoryMock
  452. params *PlaceRepositoryMockCommitTxParams
  453. results *PlaceRepositoryMockCommitTxResults
  454. Counter uint64
  455. }
  456. // PlaceRepositoryMockCommitTxParams contains parameters of the PlaceRepository.CommitTx
  457. type PlaceRepositoryMockCommitTxParams struct {
  458. tx *sql.Tx
  459. }
  460. // PlaceRepositoryMockCommitTxResults contains results of the PlaceRepository.CommitTx
  461. type PlaceRepositoryMockCommitTxResults struct {
  462. err error
  463. }
  464. // Expect sets up expected params for PlaceRepository.CommitTx
  465. func (mmCommitTx *mPlaceRepositoryMockCommitTx) Expect(tx *sql.Tx) *mPlaceRepositoryMockCommitTx {
  466. if mmCommitTx.mock.funcCommitTx != nil {
  467. mmCommitTx.mock.t.Fatalf("PlaceRepositoryMock.CommitTx mock is already set by Set")
  468. }
  469. if mmCommitTx.defaultExpectation == nil {
  470. mmCommitTx.defaultExpectation = &PlaceRepositoryMockCommitTxExpectation{}
  471. }
  472. mmCommitTx.defaultExpectation.params = &PlaceRepositoryMockCommitTxParams{tx}
  473. for _, e := range mmCommitTx.expectations {
  474. if minimock.Equal(e.params, mmCommitTx.defaultExpectation.params) {
  475. mmCommitTx.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCommitTx.defaultExpectation.params)
  476. }
  477. }
  478. return mmCommitTx
  479. }
  480. // Inspect accepts an inspector function that has same arguments as the PlaceRepository.CommitTx
  481. func (mmCommitTx *mPlaceRepositoryMockCommitTx) Inspect(f func(tx *sql.Tx)) *mPlaceRepositoryMockCommitTx {
  482. if mmCommitTx.mock.inspectFuncCommitTx != nil {
  483. mmCommitTx.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.CommitTx")
  484. }
  485. mmCommitTx.mock.inspectFuncCommitTx = f
  486. return mmCommitTx
  487. }
  488. // Return sets up results that will be returned by PlaceRepository.CommitTx
  489. func (mmCommitTx *mPlaceRepositoryMockCommitTx) Return(err error) *PlaceRepositoryMock {
  490. if mmCommitTx.mock.funcCommitTx != nil {
  491. mmCommitTx.mock.t.Fatalf("PlaceRepositoryMock.CommitTx mock is already set by Set")
  492. }
  493. if mmCommitTx.defaultExpectation == nil {
  494. mmCommitTx.defaultExpectation = &PlaceRepositoryMockCommitTxExpectation{mock: mmCommitTx.mock}
  495. }
  496. mmCommitTx.defaultExpectation.results = &PlaceRepositoryMockCommitTxResults{err}
  497. return mmCommitTx.mock
  498. }
  499. // Set uses given function f to mock the PlaceRepository.CommitTx method
  500. func (mmCommitTx *mPlaceRepositoryMockCommitTx) Set(f func(tx *sql.Tx) (err error)) *PlaceRepositoryMock {
  501. if mmCommitTx.defaultExpectation != nil {
  502. mmCommitTx.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.CommitTx method")
  503. }
  504. if len(mmCommitTx.expectations) > 0 {
  505. mmCommitTx.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.CommitTx method")
  506. }
  507. mmCommitTx.mock.funcCommitTx = f
  508. return mmCommitTx.mock
  509. }
  510. // When sets expectation for the PlaceRepository.CommitTx which will trigger the result defined by the following
  511. // Then helper
  512. func (mmCommitTx *mPlaceRepositoryMockCommitTx) When(tx *sql.Tx) *PlaceRepositoryMockCommitTxExpectation {
  513. if mmCommitTx.mock.funcCommitTx != nil {
  514. mmCommitTx.mock.t.Fatalf("PlaceRepositoryMock.CommitTx mock is already set by Set")
  515. }
  516. expectation := &PlaceRepositoryMockCommitTxExpectation{
  517. mock: mmCommitTx.mock,
  518. params: &PlaceRepositoryMockCommitTxParams{tx},
  519. }
  520. mmCommitTx.expectations = append(mmCommitTx.expectations, expectation)
  521. return expectation
  522. }
  523. // Then sets up PlaceRepository.CommitTx return parameters for the expectation previously defined by the When method
  524. func (e *PlaceRepositoryMockCommitTxExpectation) Then(err error) *PlaceRepositoryMock {
  525. e.results = &PlaceRepositoryMockCommitTxResults{err}
  526. return e.mock
  527. }
  528. // CommitTx implements interfaces.PlaceRepository
  529. func (mmCommitTx *PlaceRepositoryMock) CommitTx(tx *sql.Tx) (err error) {
  530. mm_atomic.AddUint64(&mmCommitTx.beforeCommitTxCounter, 1)
  531. defer mm_atomic.AddUint64(&mmCommitTx.afterCommitTxCounter, 1)
  532. if mmCommitTx.inspectFuncCommitTx != nil {
  533. mmCommitTx.inspectFuncCommitTx(tx)
  534. }
  535. mm_params := &PlaceRepositoryMockCommitTxParams{tx}
  536. // Record call args
  537. mmCommitTx.CommitTxMock.mutex.Lock()
  538. mmCommitTx.CommitTxMock.callArgs = append(mmCommitTx.CommitTxMock.callArgs, mm_params)
  539. mmCommitTx.CommitTxMock.mutex.Unlock()
  540. for _, e := range mmCommitTx.CommitTxMock.expectations {
  541. if minimock.Equal(e.params, mm_params) {
  542. mm_atomic.AddUint64(&e.Counter, 1)
  543. return e.results.err
  544. }
  545. }
  546. if mmCommitTx.CommitTxMock.defaultExpectation != nil {
  547. mm_atomic.AddUint64(&mmCommitTx.CommitTxMock.defaultExpectation.Counter, 1)
  548. mm_want := mmCommitTx.CommitTxMock.defaultExpectation.params
  549. mm_got := PlaceRepositoryMockCommitTxParams{tx}
  550. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  551. mmCommitTx.t.Errorf("PlaceRepositoryMock.CommitTx got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  552. }
  553. mm_results := mmCommitTx.CommitTxMock.defaultExpectation.results
  554. if mm_results == nil {
  555. mmCommitTx.t.Fatal("No results are set for the PlaceRepositoryMock.CommitTx")
  556. }
  557. return (*mm_results).err
  558. }
  559. if mmCommitTx.funcCommitTx != nil {
  560. return mmCommitTx.funcCommitTx(tx)
  561. }
  562. mmCommitTx.t.Fatalf("Unexpected call to PlaceRepositoryMock.CommitTx. %v", tx)
  563. return
  564. }
  565. // CommitTxAfterCounter returns a count of finished PlaceRepositoryMock.CommitTx invocations
  566. func (mmCommitTx *PlaceRepositoryMock) CommitTxAfterCounter() uint64 {
  567. return mm_atomic.LoadUint64(&mmCommitTx.afterCommitTxCounter)
  568. }
  569. // CommitTxBeforeCounter returns a count of PlaceRepositoryMock.CommitTx invocations
  570. func (mmCommitTx *PlaceRepositoryMock) CommitTxBeforeCounter() uint64 {
  571. return mm_atomic.LoadUint64(&mmCommitTx.beforeCommitTxCounter)
  572. }
  573. // Calls returns a list of arguments used in each call to PlaceRepositoryMock.CommitTx.
  574. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  575. func (mmCommitTx *mPlaceRepositoryMockCommitTx) Calls() []*PlaceRepositoryMockCommitTxParams {
  576. mmCommitTx.mutex.RLock()
  577. argCopy := make([]*PlaceRepositoryMockCommitTxParams, len(mmCommitTx.callArgs))
  578. copy(argCopy, mmCommitTx.callArgs)
  579. mmCommitTx.mutex.RUnlock()
  580. return argCopy
  581. }
  582. // MinimockCommitTxDone returns true if the count of the CommitTx invocations corresponds
  583. // the number of defined expectations
  584. func (m *PlaceRepositoryMock) MinimockCommitTxDone() bool {
  585. for _, e := range m.CommitTxMock.expectations {
  586. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  587. return false
  588. }
  589. }
  590. // if default expectation was set then invocations count should be greater than zero
  591. if m.CommitTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
  592. return false
  593. }
  594. // if func was set then invocations count should be greater than zero
  595. if m.funcCommitTx != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
  596. return false
  597. }
  598. return true
  599. }
  600. // MinimockCommitTxInspect logs each unmet expectation
  601. func (m *PlaceRepositoryMock) MinimockCommitTxInspect() {
  602. for _, e := range m.CommitTxMock.expectations {
  603. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  604. m.t.Errorf("Expected call to PlaceRepositoryMock.CommitTx with params: %#v", *e.params)
  605. }
  606. }
  607. // if default expectation was set then invocations count should be greater than zero
  608. if m.CommitTxMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
  609. if m.CommitTxMock.defaultExpectation.params == nil {
  610. m.t.Error("Expected call to PlaceRepositoryMock.CommitTx")
  611. } else {
  612. m.t.Errorf("Expected call to PlaceRepositoryMock.CommitTx with params: %#v", *m.CommitTxMock.defaultExpectation.params)
  613. }
  614. }
  615. // if func was set then invocations count should be greater than zero
  616. if m.funcCommitTx != nil && mm_atomic.LoadUint64(&m.afterCommitTxCounter) < 1 {
  617. m.t.Error("Expected call to PlaceRepositoryMock.CommitTx")
  618. }
  619. }
  620. type mPlaceRepositoryMockDelete struct {
  621. mock *PlaceRepositoryMock
  622. defaultExpectation *PlaceRepositoryMockDeleteExpectation
  623. expectations []*PlaceRepositoryMockDeleteExpectation
  624. callArgs []*PlaceRepositoryMockDeleteParams
  625. mutex sync.RWMutex
  626. }
  627. // PlaceRepositoryMockDeleteExpectation specifies expectation struct of the PlaceRepository.Delete
  628. type PlaceRepositoryMockDeleteExpectation struct {
  629. mock *PlaceRepositoryMock
  630. params *PlaceRepositoryMockDeleteParams
  631. results *PlaceRepositoryMockDeleteResults
  632. Counter uint64
  633. }
  634. // PlaceRepositoryMockDeleteParams contains parameters of the PlaceRepository.Delete
  635. type PlaceRepositoryMockDeleteParams struct {
  636. ctx context.Context
  637. placeID int
  638. tx *sql.Tx
  639. }
  640. // PlaceRepositoryMockDeleteResults contains results of the PlaceRepository.Delete
  641. type PlaceRepositoryMockDeleteResults struct {
  642. err error
  643. }
  644. // Expect sets up expected params for PlaceRepository.Delete
  645. func (mmDelete *mPlaceRepositoryMockDelete) Expect(ctx context.Context, placeID int, tx *sql.Tx) *mPlaceRepositoryMockDelete {
  646. if mmDelete.mock.funcDelete != nil {
  647. mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by Set")
  648. }
  649. if mmDelete.defaultExpectation == nil {
  650. mmDelete.defaultExpectation = &PlaceRepositoryMockDeleteExpectation{}
  651. }
  652. mmDelete.defaultExpectation.params = &PlaceRepositoryMockDeleteParams{ctx, placeID, tx}
  653. for _, e := range mmDelete.expectations {
  654. if minimock.Equal(e.params, mmDelete.defaultExpectation.params) {
  655. mmDelete.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDelete.defaultExpectation.params)
  656. }
  657. }
  658. return mmDelete
  659. }
  660. // Inspect accepts an inspector function that has same arguments as the PlaceRepository.Delete
  661. func (mmDelete *mPlaceRepositoryMockDelete) Inspect(f func(ctx context.Context, placeID int, tx *sql.Tx)) *mPlaceRepositoryMockDelete {
  662. if mmDelete.mock.inspectFuncDelete != nil {
  663. mmDelete.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.Delete")
  664. }
  665. mmDelete.mock.inspectFuncDelete = f
  666. return mmDelete
  667. }
  668. // Return sets up results that will be returned by PlaceRepository.Delete
  669. func (mmDelete *mPlaceRepositoryMockDelete) Return(err error) *PlaceRepositoryMock {
  670. if mmDelete.mock.funcDelete != nil {
  671. mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by Set")
  672. }
  673. if mmDelete.defaultExpectation == nil {
  674. mmDelete.defaultExpectation = &PlaceRepositoryMockDeleteExpectation{mock: mmDelete.mock}
  675. }
  676. mmDelete.defaultExpectation.results = &PlaceRepositoryMockDeleteResults{err}
  677. return mmDelete.mock
  678. }
  679. // Set uses given function f to mock the PlaceRepository.Delete method
  680. func (mmDelete *mPlaceRepositoryMockDelete) Set(f func(ctx context.Context, placeID int, tx *sql.Tx) (err error)) *PlaceRepositoryMock {
  681. if mmDelete.defaultExpectation != nil {
  682. mmDelete.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.Delete method")
  683. }
  684. if len(mmDelete.expectations) > 0 {
  685. mmDelete.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.Delete method")
  686. }
  687. mmDelete.mock.funcDelete = f
  688. return mmDelete.mock
  689. }
  690. // When sets expectation for the PlaceRepository.Delete which will trigger the result defined by the following
  691. // Then helper
  692. func (mmDelete *mPlaceRepositoryMockDelete) When(ctx context.Context, placeID int, tx *sql.Tx) *PlaceRepositoryMockDeleteExpectation {
  693. if mmDelete.mock.funcDelete != nil {
  694. mmDelete.mock.t.Fatalf("PlaceRepositoryMock.Delete mock is already set by Set")
  695. }
  696. expectation := &PlaceRepositoryMockDeleteExpectation{
  697. mock: mmDelete.mock,
  698. params: &PlaceRepositoryMockDeleteParams{ctx, placeID, tx},
  699. }
  700. mmDelete.expectations = append(mmDelete.expectations, expectation)
  701. return expectation
  702. }
  703. // Then sets up PlaceRepository.Delete return parameters for the expectation previously defined by the When method
  704. func (e *PlaceRepositoryMockDeleteExpectation) Then(err error) *PlaceRepositoryMock {
  705. e.results = &PlaceRepositoryMockDeleteResults{err}
  706. return e.mock
  707. }
  708. // Delete implements interfaces.PlaceRepository
  709. func (mmDelete *PlaceRepositoryMock) Delete(ctx context.Context, placeID int, tx *sql.Tx) (err error) {
  710. mm_atomic.AddUint64(&mmDelete.beforeDeleteCounter, 1)
  711. defer mm_atomic.AddUint64(&mmDelete.afterDeleteCounter, 1)
  712. if mmDelete.inspectFuncDelete != nil {
  713. mmDelete.inspectFuncDelete(ctx, placeID, tx)
  714. }
  715. mm_params := &PlaceRepositoryMockDeleteParams{ctx, placeID, tx}
  716. // Record call args
  717. mmDelete.DeleteMock.mutex.Lock()
  718. mmDelete.DeleteMock.callArgs = append(mmDelete.DeleteMock.callArgs, mm_params)
  719. mmDelete.DeleteMock.mutex.Unlock()
  720. for _, e := range mmDelete.DeleteMock.expectations {
  721. if minimock.Equal(e.params, mm_params) {
  722. mm_atomic.AddUint64(&e.Counter, 1)
  723. return e.results.err
  724. }
  725. }
  726. if mmDelete.DeleteMock.defaultExpectation != nil {
  727. mm_atomic.AddUint64(&mmDelete.DeleteMock.defaultExpectation.Counter, 1)
  728. mm_want := mmDelete.DeleteMock.defaultExpectation.params
  729. mm_got := PlaceRepositoryMockDeleteParams{ctx, placeID, tx}
  730. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  731. mmDelete.t.Errorf("PlaceRepositoryMock.Delete got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  732. }
  733. mm_results := mmDelete.DeleteMock.defaultExpectation.results
  734. if mm_results == nil {
  735. mmDelete.t.Fatal("No results are set for the PlaceRepositoryMock.Delete")
  736. }
  737. return (*mm_results).err
  738. }
  739. if mmDelete.funcDelete != nil {
  740. return mmDelete.funcDelete(ctx, placeID, tx)
  741. }
  742. mmDelete.t.Fatalf("Unexpected call to PlaceRepositoryMock.Delete. %v %v %v", ctx, placeID, tx)
  743. return
  744. }
  745. // DeleteAfterCounter returns a count of finished PlaceRepositoryMock.Delete invocations
  746. func (mmDelete *PlaceRepositoryMock) DeleteAfterCounter() uint64 {
  747. return mm_atomic.LoadUint64(&mmDelete.afterDeleteCounter)
  748. }
  749. // DeleteBeforeCounter returns a count of PlaceRepositoryMock.Delete invocations
  750. func (mmDelete *PlaceRepositoryMock) DeleteBeforeCounter() uint64 {
  751. return mm_atomic.LoadUint64(&mmDelete.beforeDeleteCounter)
  752. }
  753. // Calls returns a list of arguments used in each call to PlaceRepositoryMock.Delete.
  754. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  755. func (mmDelete *mPlaceRepositoryMockDelete) Calls() []*PlaceRepositoryMockDeleteParams {
  756. mmDelete.mutex.RLock()
  757. argCopy := make([]*PlaceRepositoryMockDeleteParams, len(mmDelete.callArgs))
  758. copy(argCopy, mmDelete.callArgs)
  759. mmDelete.mutex.RUnlock()
  760. return argCopy
  761. }
  762. // MinimockDeleteDone returns true if the count of the Delete invocations corresponds
  763. // the number of defined expectations
  764. func (m *PlaceRepositoryMock) MinimockDeleteDone() bool {
  765. for _, e := range m.DeleteMock.expectations {
  766. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  767. return false
  768. }
  769. }
  770. // if default expectation was set then invocations count should be greater than zero
  771. if m.DeleteMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
  772. return false
  773. }
  774. // if func was set then invocations count should be greater than zero
  775. if m.funcDelete != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
  776. return false
  777. }
  778. return true
  779. }
  780. // MinimockDeleteInspect logs each unmet expectation
  781. func (m *PlaceRepositoryMock) MinimockDeleteInspect() {
  782. for _, e := range m.DeleteMock.expectations {
  783. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  784. m.t.Errorf("Expected call to PlaceRepositoryMock.Delete with params: %#v", *e.params)
  785. }
  786. }
  787. // if default expectation was set then invocations count should be greater than zero
  788. if m.DeleteMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
  789. if m.DeleteMock.defaultExpectation.params == nil {
  790. m.t.Error("Expected call to PlaceRepositoryMock.Delete")
  791. } else {
  792. m.t.Errorf("Expected call to PlaceRepositoryMock.Delete with params: %#v", *m.DeleteMock.defaultExpectation.params)
  793. }
  794. }
  795. // if func was set then invocations count should be greater than zero
  796. if m.funcDelete != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
  797. m.t.Error("Expected call to PlaceRepositoryMock.Delete")
  798. }
  799. }
  800. type mPlaceRepositoryMockGet struct {
  801. mock *PlaceRepositoryMock
  802. defaultExpectation *PlaceRepositoryMockGetExpectation
  803. expectations []*PlaceRepositoryMockGetExpectation
  804. callArgs []*PlaceRepositoryMockGetParams
  805. mutex sync.RWMutex
  806. }
  807. // PlaceRepositoryMockGetExpectation specifies expectation struct of the PlaceRepository.Get
  808. type PlaceRepositoryMockGetExpectation struct {
  809. mock *PlaceRepositoryMock
  810. params *PlaceRepositoryMockGetParams
  811. results *PlaceRepositoryMockGetResults
  812. Counter uint64
  813. }
  814. // PlaceRepositoryMockGetParams contains parameters of the PlaceRepository.Get
  815. type PlaceRepositoryMockGetParams struct {
  816. ctx context.Context
  817. placeID int
  818. }
  819. // PlaceRepositoryMockGetResults contains results of the PlaceRepository.Get
  820. type PlaceRepositoryMockGetResults struct {
  821. pp1 *models.Place
  822. err error
  823. }
  824. // Expect sets up expected params for PlaceRepository.Get
  825. func (mmGet *mPlaceRepositoryMockGet) Expect(ctx context.Context, placeID int) *mPlaceRepositoryMockGet {
  826. if mmGet.mock.funcGet != nil {
  827. mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by Set")
  828. }
  829. if mmGet.defaultExpectation == nil {
  830. mmGet.defaultExpectation = &PlaceRepositoryMockGetExpectation{}
  831. }
  832. mmGet.defaultExpectation.params = &PlaceRepositoryMockGetParams{ctx, placeID}
  833. for _, e := range mmGet.expectations {
  834. if minimock.Equal(e.params, mmGet.defaultExpectation.params) {
  835. mmGet.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGet.defaultExpectation.params)
  836. }
  837. }
  838. return mmGet
  839. }
  840. // Inspect accepts an inspector function that has same arguments as the PlaceRepository.Get
  841. func (mmGet *mPlaceRepositoryMockGet) Inspect(f func(ctx context.Context, placeID int)) *mPlaceRepositoryMockGet {
  842. if mmGet.mock.inspectFuncGet != nil {
  843. mmGet.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.Get")
  844. }
  845. mmGet.mock.inspectFuncGet = f
  846. return mmGet
  847. }
  848. // Return sets up results that will be returned by PlaceRepository.Get
  849. func (mmGet *mPlaceRepositoryMockGet) Return(pp1 *models.Place, err error) *PlaceRepositoryMock {
  850. if mmGet.mock.funcGet != nil {
  851. mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by Set")
  852. }
  853. if mmGet.defaultExpectation == nil {
  854. mmGet.defaultExpectation = &PlaceRepositoryMockGetExpectation{mock: mmGet.mock}
  855. }
  856. mmGet.defaultExpectation.results = &PlaceRepositoryMockGetResults{pp1, err}
  857. return mmGet.mock
  858. }
  859. // Set uses given function f to mock the PlaceRepository.Get method
  860. func (mmGet *mPlaceRepositoryMockGet) Set(f func(ctx context.Context, placeID int) (pp1 *models.Place, err error)) *PlaceRepositoryMock {
  861. if mmGet.defaultExpectation != nil {
  862. mmGet.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.Get method")
  863. }
  864. if len(mmGet.expectations) > 0 {
  865. mmGet.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.Get method")
  866. }
  867. mmGet.mock.funcGet = f
  868. return mmGet.mock
  869. }
  870. // When sets expectation for the PlaceRepository.Get which will trigger the result defined by the following
  871. // Then helper
  872. func (mmGet *mPlaceRepositoryMockGet) When(ctx context.Context, placeID int) *PlaceRepositoryMockGetExpectation {
  873. if mmGet.mock.funcGet != nil {
  874. mmGet.mock.t.Fatalf("PlaceRepositoryMock.Get mock is already set by Set")
  875. }
  876. expectation := &PlaceRepositoryMockGetExpectation{
  877. mock: mmGet.mock,
  878. params: &PlaceRepositoryMockGetParams{ctx, placeID},
  879. }
  880. mmGet.expectations = append(mmGet.expectations, expectation)
  881. return expectation
  882. }
  883. // Then sets up PlaceRepository.Get return parameters for the expectation previously defined by the When method
  884. func (e *PlaceRepositoryMockGetExpectation) Then(pp1 *models.Place, err error) *PlaceRepositoryMock {
  885. e.results = &PlaceRepositoryMockGetResults{pp1, err}
  886. return e.mock
  887. }
  888. // Get implements interfaces.PlaceRepository
  889. func (mmGet *PlaceRepositoryMock) Get(ctx context.Context, placeID int) (pp1 *models.Place, err error) {
  890. mm_atomic.AddUint64(&mmGet.beforeGetCounter, 1)
  891. defer mm_atomic.AddUint64(&mmGet.afterGetCounter, 1)
  892. if mmGet.inspectFuncGet != nil {
  893. mmGet.inspectFuncGet(ctx, placeID)
  894. }
  895. mm_params := &PlaceRepositoryMockGetParams{ctx, placeID}
  896. // Record call args
  897. mmGet.GetMock.mutex.Lock()
  898. mmGet.GetMock.callArgs = append(mmGet.GetMock.callArgs, mm_params)
  899. mmGet.GetMock.mutex.Unlock()
  900. for _, e := range mmGet.GetMock.expectations {
  901. if minimock.Equal(e.params, mm_params) {
  902. mm_atomic.AddUint64(&e.Counter, 1)
  903. return e.results.pp1, e.results.err
  904. }
  905. }
  906. if mmGet.GetMock.defaultExpectation != nil {
  907. mm_atomic.AddUint64(&mmGet.GetMock.defaultExpectation.Counter, 1)
  908. mm_want := mmGet.GetMock.defaultExpectation.params
  909. mm_got := PlaceRepositoryMockGetParams{ctx, placeID}
  910. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  911. mmGet.t.Errorf("PlaceRepositoryMock.Get got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  912. }
  913. mm_results := mmGet.GetMock.defaultExpectation.results
  914. if mm_results == nil {
  915. mmGet.t.Fatal("No results are set for the PlaceRepositoryMock.Get")
  916. }
  917. return (*mm_results).pp1, (*mm_results).err
  918. }
  919. if mmGet.funcGet != nil {
  920. return mmGet.funcGet(ctx, placeID)
  921. }
  922. mmGet.t.Fatalf("Unexpected call to PlaceRepositoryMock.Get. %v %v", ctx, placeID)
  923. return
  924. }
  925. // GetAfterCounter returns a count of finished PlaceRepositoryMock.Get invocations
  926. func (mmGet *PlaceRepositoryMock) GetAfterCounter() uint64 {
  927. return mm_atomic.LoadUint64(&mmGet.afterGetCounter)
  928. }
  929. // GetBeforeCounter returns a count of PlaceRepositoryMock.Get invocations
  930. func (mmGet *PlaceRepositoryMock) GetBeforeCounter() uint64 {
  931. return mm_atomic.LoadUint64(&mmGet.beforeGetCounter)
  932. }
  933. // Calls returns a list of arguments used in each call to PlaceRepositoryMock.Get.
  934. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  935. func (mmGet *mPlaceRepositoryMockGet) Calls() []*PlaceRepositoryMockGetParams {
  936. mmGet.mutex.RLock()
  937. argCopy := make([]*PlaceRepositoryMockGetParams, len(mmGet.callArgs))
  938. copy(argCopy, mmGet.callArgs)
  939. mmGet.mutex.RUnlock()
  940. return argCopy
  941. }
  942. // MinimockGetDone returns true if the count of the Get invocations corresponds
  943. // the number of defined expectations
  944. func (m *PlaceRepositoryMock) MinimockGetDone() bool {
  945. for _, e := range m.GetMock.expectations {
  946. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  947. return false
  948. }
  949. }
  950. // if default expectation was set then invocations count should be greater than zero
  951. if m.GetMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
  952. return false
  953. }
  954. // if func was set then invocations count should be greater than zero
  955. if m.funcGet != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
  956. return false
  957. }
  958. return true
  959. }
  960. // MinimockGetInspect logs each unmet expectation
  961. func (m *PlaceRepositoryMock) MinimockGetInspect() {
  962. for _, e := range m.GetMock.expectations {
  963. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  964. m.t.Errorf("Expected call to PlaceRepositoryMock.Get with params: %#v", *e.params)
  965. }
  966. }
  967. // if default expectation was set then invocations count should be greater than zero
  968. if m.GetMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
  969. if m.GetMock.defaultExpectation.params == nil {
  970. m.t.Error("Expected call to PlaceRepositoryMock.Get")
  971. } else {
  972. m.t.Errorf("Expected call to PlaceRepositoryMock.Get with params: %#v", *m.GetMock.defaultExpectation.params)
  973. }
  974. }
  975. // if func was set then invocations count should be greater than zero
  976. if m.funcGet != nil && mm_atomic.LoadUint64(&m.afterGetCounter) < 1 {
  977. m.t.Error("Expected call to PlaceRepositoryMock.Get")
  978. }
  979. }
  980. type mPlaceRepositoryMockGetAll struct {
  981. mock *PlaceRepositoryMock
  982. defaultExpectation *PlaceRepositoryMockGetAllExpectation
  983. expectations []*PlaceRepositoryMockGetAllExpectation
  984. callArgs []*PlaceRepositoryMockGetAllParams
  985. mutex sync.RWMutex
  986. }
  987. // PlaceRepositoryMockGetAllExpectation specifies expectation struct of the PlaceRepository.GetAll
  988. type PlaceRepositoryMockGetAllExpectation struct {
  989. mock *PlaceRepositoryMock
  990. params *PlaceRepositoryMockGetAllParams
  991. results *PlaceRepositoryMockGetAllResults
  992. Counter uint64
  993. }
  994. // PlaceRepositoryMockGetAllParams contains parameters of the PlaceRepository.GetAll
  995. type PlaceRepositoryMockGetAllParams struct {
  996. ctx context.Context
  997. }
  998. // PlaceRepositoryMockGetAllResults contains results of the PlaceRepository.GetAll
  999. type PlaceRepositoryMockGetAllResults struct {
  1000. pa1 []models.Place
  1001. err error
  1002. }
  1003. // Expect sets up expected params for PlaceRepository.GetAll
  1004. func (mmGetAll *mPlaceRepositoryMockGetAll) Expect(ctx context.Context) *mPlaceRepositoryMockGetAll {
  1005. if mmGetAll.mock.funcGetAll != nil {
  1006. mmGetAll.mock.t.Fatalf("PlaceRepositoryMock.GetAll mock is already set by Set")
  1007. }
  1008. if mmGetAll.defaultExpectation == nil {
  1009. mmGetAll.defaultExpectation = &PlaceRepositoryMockGetAllExpectation{}
  1010. }
  1011. mmGetAll.defaultExpectation.params = &PlaceRepositoryMockGetAllParams{ctx}
  1012. for _, e := range mmGetAll.expectations {
  1013. if minimock.Equal(e.params, mmGetAll.defaultExpectation.params) {
  1014. mmGetAll.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetAll.defaultExpectation.params)
  1015. }
  1016. }
  1017. return mmGetAll
  1018. }
  1019. // Inspect accepts an inspector function that has same arguments as the PlaceRepository.GetAll
  1020. func (mmGetAll *mPlaceRepositoryMockGetAll) Inspect(f func(ctx context.Context)) *mPlaceRepositoryMockGetAll {
  1021. if mmGetAll.mock.inspectFuncGetAll != nil {
  1022. mmGetAll.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.GetAll")
  1023. }
  1024. mmGetAll.mock.inspectFuncGetAll = f
  1025. return mmGetAll
  1026. }
  1027. // Return sets up results that will be returned by PlaceRepository.GetAll
  1028. func (mmGetAll *mPlaceRepositoryMockGetAll) Return(pa1 []models.Place, err error) *PlaceRepositoryMock {
  1029. if mmGetAll.mock.funcGetAll != nil {
  1030. mmGetAll.mock.t.Fatalf("PlaceRepositoryMock.GetAll mock is already set by Set")
  1031. }
  1032. if mmGetAll.defaultExpectation == nil {
  1033. mmGetAll.defaultExpectation = &PlaceRepositoryMockGetAllExpectation{mock: mmGetAll.mock}
  1034. }
  1035. mmGetAll.defaultExpectation.results = &PlaceRepositoryMockGetAllResults{pa1, err}
  1036. return mmGetAll.mock
  1037. }
  1038. // Set uses given function f to mock the PlaceRepository.GetAll method
  1039. func (mmGetAll *mPlaceRepositoryMockGetAll) Set(f func(ctx context.Context) (pa1 []models.Place, err error)) *PlaceRepositoryMock {
  1040. if mmGetAll.defaultExpectation != nil {
  1041. mmGetAll.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.GetAll method")
  1042. }
  1043. if len(mmGetAll.expectations) > 0 {
  1044. mmGetAll.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.GetAll method")
  1045. }
  1046. mmGetAll.mock.funcGetAll = f
  1047. return mmGetAll.mock
  1048. }
  1049. // When sets expectation for the PlaceRepository.GetAll which will trigger the result defined by the following
  1050. // Then helper
  1051. func (mmGetAll *mPlaceRepositoryMockGetAll) When(ctx context.Context) *PlaceRepositoryMockGetAllExpectation {
  1052. if mmGetAll.mock.funcGetAll != nil {
  1053. mmGetAll.mock.t.Fatalf("PlaceRepositoryMock.GetAll mock is already set by Set")
  1054. }
  1055. expectation := &PlaceRepositoryMockGetAllExpectation{
  1056. mock: mmGetAll.mock,
  1057. params: &PlaceRepositoryMockGetAllParams{ctx},
  1058. }
  1059. mmGetAll.expectations = append(mmGetAll.expectations, expectation)
  1060. return expectation
  1061. }
  1062. // Then sets up PlaceRepository.GetAll return parameters for the expectation previously defined by the When method
  1063. func (e *PlaceRepositoryMockGetAllExpectation) Then(pa1 []models.Place, err error) *PlaceRepositoryMock {
  1064. e.results = &PlaceRepositoryMockGetAllResults{pa1, err}
  1065. return e.mock
  1066. }
  1067. // GetAll implements interfaces.PlaceRepository
  1068. func (mmGetAll *PlaceRepositoryMock) GetAll(ctx context.Context) (pa1 []models.Place, err error) {
  1069. mm_atomic.AddUint64(&mmGetAll.beforeGetAllCounter, 1)
  1070. defer mm_atomic.AddUint64(&mmGetAll.afterGetAllCounter, 1)
  1071. if mmGetAll.inspectFuncGetAll != nil {
  1072. mmGetAll.inspectFuncGetAll(ctx)
  1073. }
  1074. mm_params := &PlaceRepositoryMockGetAllParams{ctx}
  1075. // Record call args
  1076. mmGetAll.GetAllMock.mutex.Lock()
  1077. mmGetAll.GetAllMock.callArgs = append(mmGetAll.GetAllMock.callArgs, mm_params)
  1078. mmGetAll.GetAllMock.mutex.Unlock()
  1079. for _, e := range mmGetAll.GetAllMock.expectations {
  1080. if minimock.Equal(e.params, mm_params) {
  1081. mm_atomic.AddUint64(&e.Counter, 1)
  1082. return e.results.pa1, e.results.err
  1083. }
  1084. }
  1085. if mmGetAll.GetAllMock.defaultExpectation != nil {
  1086. mm_atomic.AddUint64(&mmGetAll.GetAllMock.defaultExpectation.Counter, 1)
  1087. mm_want := mmGetAll.GetAllMock.defaultExpectation.params
  1088. mm_got := PlaceRepositoryMockGetAllParams{ctx}
  1089. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  1090. mmGetAll.t.Errorf("PlaceRepositoryMock.GetAll got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  1091. }
  1092. mm_results := mmGetAll.GetAllMock.defaultExpectation.results
  1093. if mm_results == nil {
  1094. mmGetAll.t.Fatal("No results are set for the PlaceRepositoryMock.GetAll")
  1095. }
  1096. return (*mm_results).pa1, (*mm_results).err
  1097. }
  1098. if mmGetAll.funcGetAll != nil {
  1099. return mmGetAll.funcGetAll(ctx)
  1100. }
  1101. mmGetAll.t.Fatalf("Unexpected call to PlaceRepositoryMock.GetAll. %v", ctx)
  1102. return
  1103. }
  1104. // GetAllAfterCounter returns a count of finished PlaceRepositoryMock.GetAll invocations
  1105. func (mmGetAll *PlaceRepositoryMock) GetAllAfterCounter() uint64 {
  1106. return mm_atomic.LoadUint64(&mmGetAll.afterGetAllCounter)
  1107. }
  1108. // GetAllBeforeCounter returns a count of PlaceRepositoryMock.GetAll invocations
  1109. func (mmGetAll *PlaceRepositoryMock) GetAllBeforeCounter() uint64 {
  1110. return mm_atomic.LoadUint64(&mmGetAll.beforeGetAllCounter)
  1111. }
  1112. // Calls returns a list of arguments used in each call to PlaceRepositoryMock.GetAll.
  1113. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  1114. func (mmGetAll *mPlaceRepositoryMockGetAll) Calls() []*PlaceRepositoryMockGetAllParams {
  1115. mmGetAll.mutex.RLock()
  1116. argCopy := make([]*PlaceRepositoryMockGetAllParams, len(mmGetAll.callArgs))
  1117. copy(argCopy, mmGetAll.callArgs)
  1118. mmGetAll.mutex.RUnlock()
  1119. return argCopy
  1120. }
  1121. // MinimockGetAllDone returns true if the count of the GetAll invocations corresponds
  1122. // the number of defined expectations
  1123. func (m *PlaceRepositoryMock) MinimockGetAllDone() bool {
  1124. for _, e := range m.GetAllMock.expectations {
  1125. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  1126. return false
  1127. }
  1128. }
  1129. // if default expectation was set then invocations count should be greater than zero
  1130. if m.GetAllMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetAllCounter) < 1 {
  1131. return false
  1132. }
  1133. // if func was set then invocations count should be greater than zero
  1134. if m.funcGetAll != nil && mm_atomic.LoadUint64(&m.afterGetAllCounter) < 1 {
  1135. return false
  1136. }
  1137. return true
  1138. }
  1139. // MinimockGetAllInspect logs each unmet expectation
  1140. func (m *PlaceRepositoryMock) MinimockGetAllInspect() {
  1141. for _, e := range m.GetAllMock.expectations {
  1142. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  1143. m.t.Errorf("Expected call to PlaceRepositoryMock.GetAll with params: %#v", *e.params)
  1144. }
  1145. }
  1146. // if default expectation was set then invocations count should be greater than zero
  1147. if m.GetAllMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetAllCounter) < 1 {
  1148. if m.GetAllMock.defaultExpectation.params == nil {
  1149. m.t.Error("Expected call to PlaceRepositoryMock.GetAll")
  1150. } else {
  1151. m.t.Errorf("Expected call to PlaceRepositoryMock.GetAll with params: %#v", *m.GetAllMock.defaultExpectation.params)
  1152. }
  1153. }
  1154. // if func was set then invocations count should be greater than zero
  1155. if m.funcGetAll != nil && mm_atomic.LoadUint64(&m.afterGetAllCounter) < 1 {
  1156. m.t.Error("Expected call to PlaceRepositoryMock.GetAll")
  1157. }
  1158. }
  1159. type mPlaceRepositoryMockGetNestedPlaces struct {
  1160. mock *PlaceRepositoryMock
  1161. defaultExpectation *PlaceRepositoryMockGetNestedPlacesExpectation
  1162. expectations []*PlaceRepositoryMockGetNestedPlacesExpectation
  1163. callArgs []*PlaceRepositoryMockGetNestedPlacesParams
  1164. mutex sync.RWMutex
  1165. }
  1166. // PlaceRepositoryMockGetNestedPlacesExpectation specifies expectation struct of the PlaceRepository.GetNestedPlaces
  1167. type PlaceRepositoryMockGetNestedPlacesExpectation struct {
  1168. mock *PlaceRepositoryMock
  1169. params *PlaceRepositoryMockGetNestedPlacesParams
  1170. results *PlaceRepositoryMockGetNestedPlacesResults
  1171. Counter uint64
  1172. }
  1173. // PlaceRepositoryMockGetNestedPlacesParams contains parameters of the PlaceRepository.GetNestedPlaces
  1174. type PlaceRepositoryMockGetNestedPlacesParams struct {
  1175. ctx context.Context
  1176. placeID int
  1177. }
  1178. // PlaceRepositoryMockGetNestedPlacesResults contains results of the PlaceRepository.GetNestedPlaces
  1179. type PlaceRepositoryMockGetNestedPlacesResults struct {
  1180. pa1 []models.Place
  1181. err error
  1182. }
  1183. // Expect sets up expected params for PlaceRepository.GetNestedPlaces
  1184. func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Expect(ctx context.Context, placeID int) *mPlaceRepositoryMockGetNestedPlaces {
  1185. if mmGetNestedPlaces.mock.funcGetNestedPlaces != nil {
  1186. mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by Set")
  1187. }
  1188. if mmGetNestedPlaces.defaultExpectation == nil {
  1189. mmGetNestedPlaces.defaultExpectation = &PlaceRepositoryMockGetNestedPlacesExpectation{}
  1190. }
  1191. mmGetNestedPlaces.defaultExpectation.params = &PlaceRepositoryMockGetNestedPlacesParams{ctx, placeID}
  1192. for _, e := range mmGetNestedPlaces.expectations {
  1193. if minimock.Equal(e.params, mmGetNestedPlaces.defaultExpectation.params) {
  1194. mmGetNestedPlaces.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetNestedPlaces.defaultExpectation.params)
  1195. }
  1196. }
  1197. return mmGetNestedPlaces
  1198. }
  1199. // Inspect accepts an inspector function that has same arguments as the PlaceRepository.GetNestedPlaces
  1200. func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Inspect(f func(ctx context.Context, placeID int)) *mPlaceRepositoryMockGetNestedPlaces {
  1201. if mmGetNestedPlaces.mock.inspectFuncGetNestedPlaces != nil {
  1202. mmGetNestedPlaces.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.GetNestedPlaces")
  1203. }
  1204. mmGetNestedPlaces.mock.inspectFuncGetNestedPlaces = f
  1205. return mmGetNestedPlaces
  1206. }
  1207. // Return sets up results that will be returned by PlaceRepository.GetNestedPlaces
  1208. func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Return(pa1 []models.Place, err error) *PlaceRepositoryMock {
  1209. if mmGetNestedPlaces.mock.funcGetNestedPlaces != nil {
  1210. mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by Set")
  1211. }
  1212. if mmGetNestedPlaces.defaultExpectation == nil {
  1213. mmGetNestedPlaces.defaultExpectation = &PlaceRepositoryMockGetNestedPlacesExpectation{mock: mmGetNestedPlaces.mock}
  1214. }
  1215. mmGetNestedPlaces.defaultExpectation.results = &PlaceRepositoryMockGetNestedPlacesResults{pa1, err}
  1216. return mmGetNestedPlaces.mock
  1217. }
  1218. // Set uses given function f to mock the PlaceRepository.GetNestedPlaces method
  1219. func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Set(f func(ctx context.Context, placeID int) (pa1 []models.Place, err error)) *PlaceRepositoryMock {
  1220. if mmGetNestedPlaces.defaultExpectation != nil {
  1221. mmGetNestedPlaces.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.GetNestedPlaces method")
  1222. }
  1223. if len(mmGetNestedPlaces.expectations) > 0 {
  1224. mmGetNestedPlaces.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.GetNestedPlaces method")
  1225. }
  1226. mmGetNestedPlaces.mock.funcGetNestedPlaces = f
  1227. return mmGetNestedPlaces.mock
  1228. }
  1229. // When sets expectation for the PlaceRepository.GetNestedPlaces which will trigger the result defined by the following
  1230. // Then helper
  1231. func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) When(ctx context.Context, placeID int) *PlaceRepositoryMockGetNestedPlacesExpectation {
  1232. if mmGetNestedPlaces.mock.funcGetNestedPlaces != nil {
  1233. mmGetNestedPlaces.mock.t.Fatalf("PlaceRepositoryMock.GetNestedPlaces mock is already set by Set")
  1234. }
  1235. expectation := &PlaceRepositoryMockGetNestedPlacesExpectation{
  1236. mock: mmGetNestedPlaces.mock,
  1237. params: &PlaceRepositoryMockGetNestedPlacesParams{ctx, placeID},
  1238. }
  1239. mmGetNestedPlaces.expectations = append(mmGetNestedPlaces.expectations, expectation)
  1240. return expectation
  1241. }
  1242. // Then sets up PlaceRepository.GetNestedPlaces return parameters for the expectation previously defined by the When method
  1243. func (e *PlaceRepositoryMockGetNestedPlacesExpectation) Then(pa1 []models.Place, err error) *PlaceRepositoryMock {
  1244. e.results = &PlaceRepositoryMockGetNestedPlacesResults{pa1, err}
  1245. return e.mock
  1246. }
  1247. // GetNestedPlaces implements interfaces.PlaceRepository
  1248. func (mmGetNestedPlaces *PlaceRepositoryMock) GetNestedPlaces(ctx context.Context, placeID int) (pa1 []models.Place, err error) {
  1249. mm_atomic.AddUint64(&mmGetNestedPlaces.beforeGetNestedPlacesCounter, 1)
  1250. defer mm_atomic.AddUint64(&mmGetNestedPlaces.afterGetNestedPlacesCounter, 1)
  1251. if mmGetNestedPlaces.inspectFuncGetNestedPlaces != nil {
  1252. mmGetNestedPlaces.inspectFuncGetNestedPlaces(ctx, placeID)
  1253. }
  1254. mm_params := &PlaceRepositoryMockGetNestedPlacesParams{ctx, placeID}
  1255. // Record call args
  1256. mmGetNestedPlaces.GetNestedPlacesMock.mutex.Lock()
  1257. mmGetNestedPlaces.GetNestedPlacesMock.callArgs = append(mmGetNestedPlaces.GetNestedPlacesMock.callArgs, mm_params)
  1258. mmGetNestedPlaces.GetNestedPlacesMock.mutex.Unlock()
  1259. for _, e := range mmGetNestedPlaces.GetNestedPlacesMock.expectations {
  1260. if minimock.Equal(e.params, mm_params) {
  1261. mm_atomic.AddUint64(&e.Counter, 1)
  1262. return e.results.pa1, e.results.err
  1263. }
  1264. }
  1265. if mmGetNestedPlaces.GetNestedPlacesMock.defaultExpectation != nil {
  1266. mm_atomic.AddUint64(&mmGetNestedPlaces.GetNestedPlacesMock.defaultExpectation.Counter, 1)
  1267. mm_want := mmGetNestedPlaces.GetNestedPlacesMock.defaultExpectation.params
  1268. mm_got := PlaceRepositoryMockGetNestedPlacesParams{ctx, placeID}
  1269. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  1270. mmGetNestedPlaces.t.Errorf("PlaceRepositoryMock.GetNestedPlaces got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  1271. }
  1272. mm_results := mmGetNestedPlaces.GetNestedPlacesMock.defaultExpectation.results
  1273. if mm_results == nil {
  1274. mmGetNestedPlaces.t.Fatal("No results are set for the PlaceRepositoryMock.GetNestedPlaces")
  1275. }
  1276. return (*mm_results).pa1, (*mm_results).err
  1277. }
  1278. if mmGetNestedPlaces.funcGetNestedPlaces != nil {
  1279. return mmGetNestedPlaces.funcGetNestedPlaces(ctx, placeID)
  1280. }
  1281. mmGetNestedPlaces.t.Fatalf("Unexpected call to PlaceRepositoryMock.GetNestedPlaces. %v %v", ctx, placeID)
  1282. return
  1283. }
  1284. // GetNestedPlacesAfterCounter returns a count of finished PlaceRepositoryMock.GetNestedPlaces invocations
  1285. func (mmGetNestedPlaces *PlaceRepositoryMock) GetNestedPlacesAfterCounter() uint64 {
  1286. return mm_atomic.LoadUint64(&mmGetNestedPlaces.afterGetNestedPlacesCounter)
  1287. }
  1288. // GetNestedPlacesBeforeCounter returns a count of PlaceRepositoryMock.GetNestedPlaces invocations
  1289. func (mmGetNestedPlaces *PlaceRepositoryMock) GetNestedPlacesBeforeCounter() uint64 {
  1290. return mm_atomic.LoadUint64(&mmGetNestedPlaces.beforeGetNestedPlacesCounter)
  1291. }
  1292. // Calls returns a list of arguments used in each call to PlaceRepositoryMock.GetNestedPlaces.
  1293. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  1294. func (mmGetNestedPlaces *mPlaceRepositoryMockGetNestedPlaces) Calls() []*PlaceRepositoryMockGetNestedPlacesParams {
  1295. mmGetNestedPlaces.mutex.RLock()
  1296. argCopy := make([]*PlaceRepositoryMockGetNestedPlacesParams, len(mmGetNestedPlaces.callArgs))
  1297. copy(argCopy, mmGetNestedPlaces.callArgs)
  1298. mmGetNestedPlaces.mutex.RUnlock()
  1299. return argCopy
  1300. }
  1301. // MinimockGetNestedPlacesDone returns true if the count of the GetNestedPlaces invocations corresponds
  1302. // the number of defined expectations
  1303. func (m *PlaceRepositoryMock) MinimockGetNestedPlacesDone() bool {
  1304. for _, e := range m.GetNestedPlacesMock.expectations {
  1305. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  1306. return false
  1307. }
  1308. }
  1309. // if default expectation was set then invocations count should be greater than zero
  1310. if m.GetNestedPlacesMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetNestedPlacesCounter) < 1 {
  1311. return false
  1312. }
  1313. // if func was set then invocations count should be greater than zero
  1314. if m.funcGetNestedPlaces != nil && mm_atomic.LoadUint64(&m.afterGetNestedPlacesCounter) < 1 {
  1315. return false
  1316. }
  1317. return true
  1318. }
  1319. // MinimockGetNestedPlacesInspect logs each unmet expectation
  1320. func (m *PlaceRepositoryMock) MinimockGetNestedPlacesInspect() {
  1321. for _, e := range m.GetNestedPlacesMock.expectations {
  1322. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  1323. m.t.Errorf("Expected call to PlaceRepositoryMock.GetNestedPlaces with params: %#v", *e.params)
  1324. }
  1325. }
  1326. // if default expectation was set then invocations count should be greater than zero
  1327. if m.GetNestedPlacesMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetNestedPlacesCounter) < 1 {
  1328. if m.GetNestedPlacesMock.defaultExpectation.params == nil {
  1329. m.t.Error("Expected call to PlaceRepositoryMock.GetNestedPlaces")
  1330. } else {
  1331. m.t.Errorf("Expected call to PlaceRepositoryMock.GetNestedPlaces with params: %#v", *m.GetNestedPlacesMock.defaultExpectation.params)
  1332. }
  1333. }
  1334. // if func was set then invocations count should be greater than zero
  1335. if m.funcGetNestedPlaces != nil && mm_atomic.LoadUint64(&m.afterGetNestedPlacesCounter) < 1 {
  1336. m.t.Error("Expected call to PlaceRepositoryMock.GetNestedPlaces")
  1337. }
  1338. }
  1339. type mPlaceRepositoryMockUpdate struct {
  1340. mock *PlaceRepositoryMock
  1341. defaultExpectation *PlaceRepositoryMockUpdateExpectation
  1342. expectations []*PlaceRepositoryMockUpdateExpectation
  1343. callArgs []*PlaceRepositoryMockUpdateParams
  1344. mutex sync.RWMutex
  1345. }
  1346. // PlaceRepositoryMockUpdateExpectation specifies expectation struct of the PlaceRepository.Update
  1347. type PlaceRepositoryMockUpdateExpectation struct {
  1348. mock *PlaceRepositoryMock
  1349. params *PlaceRepositoryMockUpdateParams
  1350. results *PlaceRepositoryMockUpdateResults
  1351. Counter uint64
  1352. }
  1353. // PlaceRepositoryMockUpdateParams contains parameters of the PlaceRepository.Update
  1354. type PlaceRepositoryMockUpdateParams struct {
  1355. ctx context.Context
  1356. req models.UpdatePlaceRequest
  1357. tx *sql.Tx
  1358. }
  1359. // PlaceRepositoryMockUpdateResults contains results of the PlaceRepository.Update
  1360. type PlaceRepositoryMockUpdateResults struct {
  1361. err error
  1362. }
  1363. // Expect sets up expected params for PlaceRepository.Update
  1364. func (mmUpdate *mPlaceRepositoryMockUpdate) Expect(ctx context.Context, req models.UpdatePlaceRequest, tx *sql.Tx) *mPlaceRepositoryMockUpdate {
  1365. if mmUpdate.mock.funcUpdate != nil {
  1366. mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by Set")
  1367. }
  1368. if mmUpdate.defaultExpectation == nil {
  1369. mmUpdate.defaultExpectation = &PlaceRepositoryMockUpdateExpectation{}
  1370. }
  1371. mmUpdate.defaultExpectation.params = &PlaceRepositoryMockUpdateParams{ctx, req, tx}
  1372. for _, e := range mmUpdate.expectations {
  1373. if minimock.Equal(e.params, mmUpdate.defaultExpectation.params) {
  1374. mmUpdate.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdate.defaultExpectation.params)
  1375. }
  1376. }
  1377. return mmUpdate
  1378. }
  1379. // Inspect accepts an inspector function that has same arguments as the PlaceRepository.Update
  1380. func (mmUpdate *mPlaceRepositoryMockUpdate) Inspect(f func(ctx context.Context, req models.UpdatePlaceRequest, tx *sql.Tx)) *mPlaceRepositoryMockUpdate {
  1381. if mmUpdate.mock.inspectFuncUpdate != nil {
  1382. mmUpdate.mock.t.Fatalf("Inspect function is already set for PlaceRepositoryMock.Update")
  1383. }
  1384. mmUpdate.mock.inspectFuncUpdate = f
  1385. return mmUpdate
  1386. }
  1387. // Return sets up results that will be returned by PlaceRepository.Update
  1388. func (mmUpdate *mPlaceRepositoryMockUpdate) Return(err error) *PlaceRepositoryMock {
  1389. if mmUpdate.mock.funcUpdate != nil {
  1390. mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by Set")
  1391. }
  1392. if mmUpdate.defaultExpectation == nil {
  1393. mmUpdate.defaultExpectation = &PlaceRepositoryMockUpdateExpectation{mock: mmUpdate.mock}
  1394. }
  1395. mmUpdate.defaultExpectation.results = &PlaceRepositoryMockUpdateResults{err}
  1396. return mmUpdate.mock
  1397. }
  1398. // Set uses given function f to mock the PlaceRepository.Update method
  1399. func (mmUpdate *mPlaceRepositoryMockUpdate) Set(f func(ctx context.Context, req models.UpdatePlaceRequest, tx *sql.Tx) (err error)) *PlaceRepositoryMock {
  1400. if mmUpdate.defaultExpectation != nil {
  1401. mmUpdate.mock.t.Fatalf("Default expectation is already set for the PlaceRepository.Update method")
  1402. }
  1403. if len(mmUpdate.expectations) > 0 {
  1404. mmUpdate.mock.t.Fatalf("Some expectations are already set for the PlaceRepository.Update method")
  1405. }
  1406. mmUpdate.mock.funcUpdate = f
  1407. return mmUpdate.mock
  1408. }
  1409. // When sets expectation for the PlaceRepository.Update which will trigger the result defined by the following
  1410. // Then helper
  1411. func (mmUpdate *mPlaceRepositoryMockUpdate) When(ctx context.Context, req models.UpdatePlaceRequest, tx *sql.Tx) *PlaceRepositoryMockUpdateExpectation {
  1412. if mmUpdate.mock.funcUpdate != nil {
  1413. mmUpdate.mock.t.Fatalf("PlaceRepositoryMock.Update mock is already set by Set")
  1414. }
  1415. expectation := &PlaceRepositoryMockUpdateExpectation{
  1416. mock: mmUpdate.mock,
  1417. params: &PlaceRepositoryMockUpdateParams{ctx, req, tx},
  1418. }
  1419. mmUpdate.expectations = append(mmUpdate.expectations, expectation)
  1420. return expectation
  1421. }
  1422. // Then sets up PlaceRepository.Update return parameters for the expectation previously defined by the When method
  1423. func (e *PlaceRepositoryMockUpdateExpectation) Then(err error) *PlaceRepositoryMock {
  1424. e.results = &PlaceRepositoryMockUpdateResults{err}
  1425. return e.mock
  1426. }
  1427. // Update implements interfaces.PlaceRepository
  1428. func (mmUpdate *PlaceRepositoryMock) Update(ctx context.Context, req models.UpdatePlaceRequest, tx *sql.Tx) (err error) {
  1429. mm_atomic.AddUint64(&mmUpdate.beforeUpdateCounter, 1)
  1430. defer mm_atomic.AddUint64(&mmUpdate.afterUpdateCounter, 1)
  1431. if mmUpdate.inspectFuncUpdate != nil {
  1432. mmUpdate.inspectFuncUpdate(ctx, req, tx)
  1433. }
  1434. mm_params := &PlaceRepositoryMockUpdateParams{ctx, req, tx}
  1435. // Record call args
  1436. mmUpdate.UpdateMock.mutex.Lock()
  1437. mmUpdate.UpdateMock.callArgs = append(mmUpdate.UpdateMock.callArgs, mm_params)
  1438. mmUpdate.UpdateMock.mutex.Unlock()
  1439. for _, e := range mmUpdate.UpdateMock.expectations {
  1440. if minimock.Equal(e.params, mm_params) {
  1441. mm_atomic.AddUint64(&e.Counter, 1)
  1442. return e.results.err
  1443. }
  1444. }
  1445. if mmUpdate.UpdateMock.defaultExpectation != nil {
  1446. mm_atomic.AddUint64(&mmUpdate.UpdateMock.defaultExpectation.Counter, 1)
  1447. mm_want := mmUpdate.UpdateMock.defaultExpectation.params
  1448. mm_got := PlaceRepositoryMockUpdateParams{ctx, req, tx}
  1449. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  1450. mmUpdate.t.Errorf("PlaceRepositoryMock.Update got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  1451. }
  1452. mm_results := mmUpdate.UpdateMock.defaultExpectation.results
  1453. if mm_results == nil {
  1454. mmUpdate.t.Fatal("No results are set for the PlaceRepositoryMock.Update")
  1455. }
  1456. return (*mm_results).err
  1457. }
  1458. if mmUpdate.funcUpdate != nil {
  1459. return mmUpdate.funcUpdate(ctx, req, tx)
  1460. }
  1461. mmUpdate.t.Fatalf("Unexpected call to PlaceRepositoryMock.Update. %v %v %v", ctx, req, tx)
  1462. return
  1463. }
  1464. // UpdateAfterCounter returns a count of finished PlaceRepositoryMock.Update invocations
  1465. func (mmUpdate *PlaceRepositoryMock) UpdateAfterCounter() uint64 {
  1466. return mm_atomic.LoadUint64(&mmUpdate.afterUpdateCounter)
  1467. }
  1468. // UpdateBeforeCounter returns a count of PlaceRepositoryMock.Update invocations
  1469. func (mmUpdate *PlaceRepositoryMock) UpdateBeforeCounter() uint64 {
  1470. return mm_atomic.LoadUint64(&mmUpdate.beforeUpdateCounter)
  1471. }
  1472. // Calls returns a list of arguments used in each call to PlaceRepositoryMock.Update.
  1473. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  1474. func (mmUpdate *mPlaceRepositoryMockUpdate) Calls() []*PlaceRepositoryMockUpdateParams {
  1475. mmUpdate.mutex.RLock()
  1476. argCopy := make([]*PlaceRepositoryMockUpdateParams, len(mmUpdate.callArgs))
  1477. copy(argCopy, mmUpdate.callArgs)
  1478. mmUpdate.mutex.RUnlock()
  1479. return argCopy
  1480. }
  1481. // MinimockUpdateDone returns true if the count of the Update invocations corresponds
  1482. // the number of defined expectations
  1483. func (m *PlaceRepositoryMock) MinimockUpdateDone() bool {
  1484. for _, e := range m.UpdateMock.expectations {
  1485. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  1486. return false
  1487. }
  1488. }
  1489. // if default expectation was set then invocations count should be greater than zero
  1490. if m.UpdateMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterUpdateCounter) < 1 {
  1491. return false
  1492. }
  1493. // if func was set then invocations count should be greater than zero
  1494. if m.funcUpdate != nil && mm_atomic.LoadUint64(&m.afterUpdateCounter) < 1 {
  1495. return false
  1496. }
  1497. return true
  1498. }
  1499. // MinimockUpdateInspect logs each unmet expectation
  1500. func (m *PlaceRepositoryMock) MinimockUpdateInspect() {
  1501. for _, e := range m.UpdateMock.expectations {
  1502. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  1503. m.t.Errorf("Expected call to PlaceRepositoryMock.Update with params: %#v", *e.params)
  1504. }
  1505. }
  1506. // if default expectation was set then invocations count should be greater than zero
  1507. if m.UpdateMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterUpdateCounter) < 1 {
  1508. if m.UpdateMock.defaultExpectation.params == nil {
  1509. m.t.Error("Expected call to PlaceRepositoryMock.Update")
  1510. } else {
  1511. m.t.Errorf("Expected call to PlaceRepositoryMock.Update with params: %#v", *m.UpdateMock.defaultExpectation.params)
  1512. }
  1513. }
  1514. // if func was set then invocations count should be greater than zero
  1515. if m.funcUpdate != nil && mm_atomic.LoadUint64(&m.afterUpdateCounter) < 1 {
  1516. m.t.Error("Expected call to PlaceRepositoryMock.Update")
  1517. }
  1518. }
  1519. // MinimockFinish checks that all mocked methods have been called the expected number of times
  1520. func (m *PlaceRepositoryMock) MinimockFinish() {
  1521. if !m.minimockDone() {
  1522. m.MinimockAddInspect()
  1523. m.MinimockBeginTxInspect()
  1524. m.MinimockCommitTxInspect()
  1525. m.MinimockDeleteInspect()
  1526. m.MinimockGetInspect()
  1527. m.MinimockGetAllInspect()
  1528. m.MinimockGetNestedPlacesInspect()
  1529. m.MinimockUpdateInspect()
  1530. m.t.FailNow()
  1531. }
  1532. }
  1533. // MinimockWait waits for all mocked methods to be called the expected number of times
  1534. func (m *PlaceRepositoryMock) MinimockWait(timeout mm_time.Duration) {
  1535. timeoutCh := mm_time.After(timeout)
  1536. for {
  1537. if m.minimockDone() {
  1538. return
  1539. }
  1540. select {
  1541. case <-timeoutCh:
  1542. m.MinimockFinish()
  1543. return
  1544. case <-mm_time.After(10 * mm_time.Millisecond):
  1545. }
  1546. }
  1547. }
  1548. func (m *PlaceRepositoryMock) minimockDone() bool {
  1549. done := true
  1550. return done &&
  1551. m.MinimockAddDone() &&
  1552. m.MinimockBeginTxDone() &&
  1553. m.MinimockCommitTxDone() &&
  1554. m.MinimockDeleteDone() &&
  1555. m.MinimockGetDone() &&
  1556. m.MinimockGetAllDone() &&
  1557. m.MinimockGetNestedPlacesDone() &&
  1558. m.MinimockUpdateDone()
  1559. }