place_image_repository_minimock.go 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392
  1. // Code generated by http://github.com/gojuno/minimock (v3.3.14). DO NOT EDIT.
  2. package mocks
  3. //go:generate minimock -i git.dmitriygnatenko.ru/dima/homethings/internal/api/v1/image.PlaceImageRepository -o place_image_repository_minimock.go -n PlaceImageRepositoryMock -p mocks
  4. import (
  5. "context"
  6. "sync"
  7. mm_atomic "sync/atomic"
  8. mm_time "time"
  9. "git.dmitriygnatenko.ru/dima/homethings/internal/models"
  10. "github.com/gojuno/minimock/v3"
  11. )
  12. // PlaceImageRepositoryMock implements image.PlaceImageRepository
  13. type PlaceImageRepositoryMock struct {
  14. t minimock.Tester
  15. finishOnce sync.Once
  16. funcAdd func(ctx context.Context, req models.AddPlaceImageRequest) (err error)
  17. inspectFuncAdd func(ctx context.Context, req models.AddPlaceImageRequest)
  18. afterAddCounter uint64
  19. beforeAddCounter uint64
  20. AddMock mPlaceImageRepositoryMockAdd
  21. funcDelete func(ctx context.Context, id uint64) (err error)
  22. inspectFuncDelete func(ctx context.Context, id uint64)
  23. afterDeleteCounter uint64
  24. beforeDeleteCounter uint64
  25. DeleteMock mPlaceImageRepositoryMockDelete
  26. funcGet func(ctx context.Context, id uint64) (ip1 *models.Image, err error)
  27. inspectFuncGet func(ctx context.Context, id uint64)
  28. afterGetCounter uint64
  29. beforeGetCounter uint64
  30. GetMock mPlaceImageRepositoryMockGet
  31. funcGetByPlaceID func(ctx context.Context, id uint64) (ia1 []models.Image, err error)
  32. inspectFuncGetByPlaceID func(ctx context.Context, id uint64)
  33. afterGetByPlaceIDCounter uint64
  34. beforeGetByPlaceIDCounter uint64
  35. GetByPlaceIDMock mPlaceImageRepositoryMockGetByPlaceID
  36. }
  37. // NewPlaceImageRepositoryMock returns a mock for image.PlaceImageRepository
  38. func NewPlaceImageRepositoryMock(t minimock.Tester) *PlaceImageRepositoryMock {
  39. m := &PlaceImageRepositoryMock{t: t}
  40. if controller, ok := t.(minimock.MockController); ok {
  41. controller.RegisterMocker(m)
  42. }
  43. m.AddMock = mPlaceImageRepositoryMockAdd{mock: m}
  44. m.AddMock.callArgs = []*PlaceImageRepositoryMockAddParams{}
  45. m.DeleteMock = mPlaceImageRepositoryMockDelete{mock: m}
  46. m.DeleteMock.callArgs = []*PlaceImageRepositoryMockDeleteParams{}
  47. m.GetMock = mPlaceImageRepositoryMockGet{mock: m}
  48. m.GetMock.callArgs = []*PlaceImageRepositoryMockGetParams{}
  49. m.GetByPlaceIDMock = mPlaceImageRepositoryMockGetByPlaceID{mock: m}
  50. m.GetByPlaceIDMock.callArgs = []*PlaceImageRepositoryMockGetByPlaceIDParams{}
  51. t.Cleanup(m.MinimockFinish)
  52. return m
  53. }
  54. type mPlaceImageRepositoryMockAdd struct {
  55. optional bool
  56. mock *PlaceImageRepositoryMock
  57. defaultExpectation *PlaceImageRepositoryMockAddExpectation
  58. expectations []*PlaceImageRepositoryMockAddExpectation
  59. callArgs []*PlaceImageRepositoryMockAddParams
  60. mutex sync.RWMutex
  61. expectedInvocations uint64
  62. }
  63. // PlaceImageRepositoryMockAddExpectation specifies expectation struct of the PlaceImageRepository.Add
  64. type PlaceImageRepositoryMockAddExpectation struct {
  65. mock *PlaceImageRepositoryMock
  66. params *PlaceImageRepositoryMockAddParams
  67. paramPtrs *PlaceImageRepositoryMockAddParamPtrs
  68. results *PlaceImageRepositoryMockAddResults
  69. Counter uint64
  70. }
  71. // PlaceImageRepositoryMockAddParams contains parameters of the PlaceImageRepository.Add
  72. type PlaceImageRepositoryMockAddParams struct {
  73. ctx context.Context
  74. req models.AddPlaceImageRequest
  75. }
  76. // PlaceImageRepositoryMockAddParamPtrs contains pointers to parameters of the PlaceImageRepository.Add
  77. type PlaceImageRepositoryMockAddParamPtrs struct {
  78. ctx *context.Context
  79. req *models.AddPlaceImageRequest
  80. }
  81. // PlaceImageRepositoryMockAddResults contains results of the PlaceImageRepository.Add
  82. type PlaceImageRepositoryMockAddResults struct {
  83. err error
  84. }
  85. // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
  86. // the test will fail minimock's automatic final call check if the mocked method was not called at least once.
  87. // Optional() makes method check to work in '0 or more' mode.
  88. // It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
  89. // catch the problems when the expected method call is totally skipped during test run.
  90. func (mmAdd *mPlaceImageRepositoryMockAdd) Optional() *mPlaceImageRepositoryMockAdd {
  91. mmAdd.optional = true
  92. return mmAdd
  93. }
  94. // Expect sets up expected params for PlaceImageRepository.Add
  95. func (mmAdd *mPlaceImageRepositoryMockAdd) Expect(ctx context.Context, req models.AddPlaceImageRequest) *mPlaceImageRepositoryMockAdd {
  96. if mmAdd.mock.funcAdd != nil {
  97. mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by Set")
  98. }
  99. if mmAdd.defaultExpectation == nil {
  100. mmAdd.defaultExpectation = &PlaceImageRepositoryMockAddExpectation{}
  101. }
  102. if mmAdd.defaultExpectation.paramPtrs != nil {
  103. mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by ExpectParams functions")
  104. }
  105. mmAdd.defaultExpectation.params = &PlaceImageRepositoryMockAddParams{ctx, req}
  106. for _, e := range mmAdd.expectations {
  107. if minimock.Equal(e.params, mmAdd.defaultExpectation.params) {
  108. mmAdd.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmAdd.defaultExpectation.params)
  109. }
  110. }
  111. return mmAdd
  112. }
  113. // ExpectCtxParam1 sets up expected param ctx for PlaceImageRepository.Add
  114. func (mmAdd *mPlaceImageRepositoryMockAdd) ExpectCtxParam1(ctx context.Context) *mPlaceImageRepositoryMockAdd {
  115. if mmAdd.mock.funcAdd != nil {
  116. mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by Set")
  117. }
  118. if mmAdd.defaultExpectation == nil {
  119. mmAdd.defaultExpectation = &PlaceImageRepositoryMockAddExpectation{}
  120. }
  121. if mmAdd.defaultExpectation.params != nil {
  122. mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by Expect")
  123. }
  124. if mmAdd.defaultExpectation.paramPtrs == nil {
  125. mmAdd.defaultExpectation.paramPtrs = &PlaceImageRepositoryMockAddParamPtrs{}
  126. }
  127. mmAdd.defaultExpectation.paramPtrs.ctx = &ctx
  128. return mmAdd
  129. }
  130. // ExpectReqParam2 sets up expected param req for PlaceImageRepository.Add
  131. func (mmAdd *mPlaceImageRepositoryMockAdd) ExpectReqParam2(req models.AddPlaceImageRequest) *mPlaceImageRepositoryMockAdd {
  132. if mmAdd.mock.funcAdd != nil {
  133. mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by Set")
  134. }
  135. if mmAdd.defaultExpectation == nil {
  136. mmAdd.defaultExpectation = &PlaceImageRepositoryMockAddExpectation{}
  137. }
  138. if mmAdd.defaultExpectation.params != nil {
  139. mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by Expect")
  140. }
  141. if mmAdd.defaultExpectation.paramPtrs == nil {
  142. mmAdd.defaultExpectation.paramPtrs = &PlaceImageRepositoryMockAddParamPtrs{}
  143. }
  144. mmAdd.defaultExpectation.paramPtrs.req = &req
  145. return mmAdd
  146. }
  147. // Inspect accepts an inspector function that has same arguments as the PlaceImageRepository.Add
  148. func (mmAdd *mPlaceImageRepositoryMockAdd) Inspect(f func(ctx context.Context, req models.AddPlaceImageRequest)) *mPlaceImageRepositoryMockAdd {
  149. if mmAdd.mock.inspectFuncAdd != nil {
  150. mmAdd.mock.t.Fatalf("Inspect function is already set for PlaceImageRepositoryMock.Add")
  151. }
  152. mmAdd.mock.inspectFuncAdd = f
  153. return mmAdd
  154. }
  155. // Return sets up results that will be returned by PlaceImageRepository.Add
  156. func (mmAdd *mPlaceImageRepositoryMockAdd) Return(err error) *PlaceImageRepositoryMock {
  157. if mmAdd.mock.funcAdd != nil {
  158. mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by Set")
  159. }
  160. if mmAdd.defaultExpectation == nil {
  161. mmAdd.defaultExpectation = &PlaceImageRepositoryMockAddExpectation{mock: mmAdd.mock}
  162. }
  163. mmAdd.defaultExpectation.results = &PlaceImageRepositoryMockAddResults{err}
  164. return mmAdd.mock
  165. }
  166. // Set uses given function f to mock the PlaceImageRepository.Add method
  167. func (mmAdd *mPlaceImageRepositoryMockAdd) Set(f func(ctx context.Context, req models.AddPlaceImageRequest) (err error)) *PlaceImageRepositoryMock {
  168. if mmAdd.defaultExpectation != nil {
  169. mmAdd.mock.t.Fatalf("Default expectation is already set for the PlaceImageRepository.Add method")
  170. }
  171. if len(mmAdd.expectations) > 0 {
  172. mmAdd.mock.t.Fatalf("Some expectations are already set for the PlaceImageRepository.Add method")
  173. }
  174. mmAdd.mock.funcAdd = f
  175. return mmAdd.mock
  176. }
  177. // When sets expectation for the PlaceImageRepository.Add which will trigger the result defined by the following
  178. // Then helper
  179. func (mmAdd *mPlaceImageRepositoryMockAdd) When(ctx context.Context, req models.AddPlaceImageRequest) *PlaceImageRepositoryMockAddExpectation {
  180. if mmAdd.mock.funcAdd != nil {
  181. mmAdd.mock.t.Fatalf("PlaceImageRepositoryMock.Add mock is already set by Set")
  182. }
  183. expectation := &PlaceImageRepositoryMockAddExpectation{
  184. mock: mmAdd.mock,
  185. params: &PlaceImageRepositoryMockAddParams{ctx, req},
  186. }
  187. mmAdd.expectations = append(mmAdd.expectations, expectation)
  188. return expectation
  189. }
  190. // Then sets up PlaceImageRepository.Add return parameters for the expectation previously defined by the When method
  191. func (e *PlaceImageRepositoryMockAddExpectation) Then(err error) *PlaceImageRepositoryMock {
  192. e.results = &PlaceImageRepositoryMockAddResults{err}
  193. return e.mock
  194. }
  195. // Times sets number of times PlaceImageRepository.Add should be invoked
  196. func (mmAdd *mPlaceImageRepositoryMockAdd) Times(n uint64) *mPlaceImageRepositoryMockAdd {
  197. if n == 0 {
  198. mmAdd.mock.t.Fatalf("Times of PlaceImageRepositoryMock.Add mock can not be zero")
  199. }
  200. mm_atomic.StoreUint64(&mmAdd.expectedInvocations, n)
  201. return mmAdd
  202. }
  203. func (mmAdd *mPlaceImageRepositoryMockAdd) invocationsDone() bool {
  204. if len(mmAdd.expectations) == 0 && mmAdd.defaultExpectation == nil && mmAdd.mock.funcAdd == nil {
  205. return true
  206. }
  207. totalInvocations := mm_atomic.LoadUint64(&mmAdd.mock.afterAddCounter)
  208. expectedInvocations := mm_atomic.LoadUint64(&mmAdd.expectedInvocations)
  209. return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
  210. }
  211. // Add implements image.PlaceImageRepository
  212. func (mmAdd *PlaceImageRepositoryMock) Add(ctx context.Context, req models.AddPlaceImageRequest) (err error) {
  213. mm_atomic.AddUint64(&mmAdd.beforeAddCounter, 1)
  214. defer mm_atomic.AddUint64(&mmAdd.afterAddCounter, 1)
  215. if mmAdd.inspectFuncAdd != nil {
  216. mmAdd.inspectFuncAdd(ctx, req)
  217. }
  218. mm_params := PlaceImageRepositoryMockAddParams{ctx, req}
  219. // Record call args
  220. mmAdd.AddMock.mutex.Lock()
  221. mmAdd.AddMock.callArgs = append(mmAdd.AddMock.callArgs, &mm_params)
  222. mmAdd.AddMock.mutex.Unlock()
  223. for _, e := range mmAdd.AddMock.expectations {
  224. if minimock.Equal(*e.params, mm_params) {
  225. mm_atomic.AddUint64(&e.Counter, 1)
  226. return e.results.err
  227. }
  228. }
  229. if mmAdd.AddMock.defaultExpectation != nil {
  230. mm_atomic.AddUint64(&mmAdd.AddMock.defaultExpectation.Counter, 1)
  231. mm_want := mmAdd.AddMock.defaultExpectation.params
  232. mm_want_ptrs := mmAdd.AddMock.defaultExpectation.paramPtrs
  233. mm_got := PlaceImageRepositoryMockAddParams{ctx, req}
  234. if mm_want_ptrs != nil {
  235. if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
  236. mmAdd.t.Errorf("PlaceImageRepositoryMock.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))
  237. }
  238. if mm_want_ptrs.req != nil && !minimock.Equal(*mm_want_ptrs.req, mm_got.req) {
  239. mmAdd.t.Errorf("PlaceImageRepositoryMock.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))
  240. }
  241. } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  242. mmAdd.t.Errorf("PlaceImageRepositoryMock.Add got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  243. }
  244. mm_results := mmAdd.AddMock.defaultExpectation.results
  245. if mm_results == nil {
  246. mmAdd.t.Fatal("No results are set for the PlaceImageRepositoryMock.Add")
  247. }
  248. return (*mm_results).err
  249. }
  250. if mmAdd.funcAdd != nil {
  251. return mmAdd.funcAdd(ctx, req)
  252. }
  253. mmAdd.t.Fatalf("Unexpected call to PlaceImageRepositoryMock.Add. %v %v", ctx, req)
  254. return
  255. }
  256. // AddAfterCounter returns a count of finished PlaceImageRepositoryMock.Add invocations
  257. func (mmAdd *PlaceImageRepositoryMock) AddAfterCounter() uint64 {
  258. return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
  259. }
  260. // AddBeforeCounter returns a count of PlaceImageRepositoryMock.Add invocations
  261. func (mmAdd *PlaceImageRepositoryMock) AddBeforeCounter() uint64 {
  262. return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
  263. }
  264. // Calls returns a list of arguments used in each call to PlaceImageRepositoryMock.Add.
  265. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  266. func (mmAdd *mPlaceImageRepositoryMockAdd) Calls() []*PlaceImageRepositoryMockAddParams {
  267. mmAdd.mutex.RLock()
  268. argCopy := make([]*PlaceImageRepositoryMockAddParams, len(mmAdd.callArgs))
  269. copy(argCopy, mmAdd.callArgs)
  270. mmAdd.mutex.RUnlock()
  271. return argCopy
  272. }
  273. // MinimockAddDone returns true if the count of the Add invocations corresponds
  274. // the number of defined expectations
  275. func (m *PlaceImageRepositoryMock) MinimockAddDone() bool {
  276. if m.AddMock.optional {
  277. // Optional methods provide '0 or more' call count restriction.
  278. return true
  279. }
  280. for _, e := range m.AddMock.expectations {
  281. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  282. return false
  283. }
  284. }
  285. return m.AddMock.invocationsDone()
  286. }
  287. // MinimockAddInspect logs each unmet expectation
  288. func (m *PlaceImageRepositoryMock) MinimockAddInspect() {
  289. for _, e := range m.AddMock.expectations {
  290. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  291. m.t.Errorf("Expected call to PlaceImageRepositoryMock.Add with params: %#v", *e.params)
  292. }
  293. }
  294. afterAddCounter := mm_atomic.LoadUint64(&m.afterAddCounter)
  295. // if default expectation was set then invocations count should be greater than zero
  296. if m.AddMock.defaultExpectation != nil && afterAddCounter < 1 {
  297. if m.AddMock.defaultExpectation.params == nil {
  298. m.t.Error("Expected call to PlaceImageRepositoryMock.Add")
  299. } else {
  300. m.t.Errorf("Expected call to PlaceImageRepositoryMock.Add with params: %#v", *m.AddMock.defaultExpectation.params)
  301. }
  302. }
  303. // if func was set then invocations count should be greater than zero
  304. if m.funcAdd != nil && afterAddCounter < 1 {
  305. m.t.Error("Expected call to PlaceImageRepositoryMock.Add")
  306. }
  307. if !m.AddMock.invocationsDone() && afterAddCounter > 0 {
  308. m.t.Errorf("Expected %d calls to PlaceImageRepositoryMock.Add but found %d calls",
  309. mm_atomic.LoadUint64(&m.AddMock.expectedInvocations), afterAddCounter)
  310. }
  311. }
  312. type mPlaceImageRepositoryMockDelete struct {
  313. optional bool
  314. mock *PlaceImageRepositoryMock
  315. defaultExpectation *PlaceImageRepositoryMockDeleteExpectation
  316. expectations []*PlaceImageRepositoryMockDeleteExpectation
  317. callArgs []*PlaceImageRepositoryMockDeleteParams
  318. mutex sync.RWMutex
  319. expectedInvocations uint64
  320. }
  321. // PlaceImageRepositoryMockDeleteExpectation specifies expectation struct of the PlaceImageRepository.Delete
  322. type PlaceImageRepositoryMockDeleteExpectation struct {
  323. mock *PlaceImageRepositoryMock
  324. params *PlaceImageRepositoryMockDeleteParams
  325. paramPtrs *PlaceImageRepositoryMockDeleteParamPtrs
  326. results *PlaceImageRepositoryMockDeleteResults
  327. Counter uint64
  328. }
  329. // PlaceImageRepositoryMockDeleteParams contains parameters of the PlaceImageRepository.Delete
  330. type PlaceImageRepositoryMockDeleteParams struct {
  331. ctx context.Context
  332. id uint64
  333. }
  334. // PlaceImageRepositoryMockDeleteParamPtrs contains pointers to parameters of the PlaceImageRepository.Delete
  335. type PlaceImageRepositoryMockDeleteParamPtrs struct {
  336. ctx *context.Context
  337. id *uint64
  338. }
  339. // PlaceImageRepositoryMockDeleteResults contains results of the PlaceImageRepository.Delete
  340. type PlaceImageRepositoryMockDeleteResults struct {
  341. err error
  342. }
  343. // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
  344. // the test will fail minimock's automatic final call check if the mocked method was not called at least once.
  345. // Optional() makes method check to work in '0 or more' mode.
  346. // It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
  347. // catch the problems when the expected method call is totally skipped during test run.
  348. func (mmDelete *mPlaceImageRepositoryMockDelete) Optional() *mPlaceImageRepositoryMockDelete {
  349. mmDelete.optional = true
  350. return mmDelete
  351. }
  352. // Expect sets up expected params for PlaceImageRepository.Delete
  353. func (mmDelete *mPlaceImageRepositoryMockDelete) Expect(ctx context.Context, id uint64) *mPlaceImageRepositoryMockDelete {
  354. if mmDelete.mock.funcDelete != nil {
  355. mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by Set")
  356. }
  357. if mmDelete.defaultExpectation == nil {
  358. mmDelete.defaultExpectation = &PlaceImageRepositoryMockDeleteExpectation{}
  359. }
  360. if mmDelete.defaultExpectation.paramPtrs != nil {
  361. mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by ExpectParams functions")
  362. }
  363. mmDelete.defaultExpectation.params = &PlaceImageRepositoryMockDeleteParams{ctx, id}
  364. for _, e := range mmDelete.expectations {
  365. if minimock.Equal(e.params, mmDelete.defaultExpectation.params) {
  366. mmDelete.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDelete.defaultExpectation.params)
  367. }
  368. }
  369. return mmDelete
  370. }
  371. // ExpectCtxParam1 sets up expected param ctx for PlaceImageRepository.Delete
  372. func (mmDelete *mPlaceImageRepositoryMockDelete) ExpectCtxParam1(ctx context.Context) *mPlaceImageRepositoryMockDelete {
  373. if mmDelete.mock.funcDelete != nil {
  374. mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by Set")
  375. }
  376. if mmDelete.defaultExpectation == nil {
  377. mmDelete.defaultExpectation = &PlaceImageRepositoryMockDeleteExpectation{}
  378. }
  379. if mmDelete.defaultExpectation.params != nil {
  380. mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by Expect")
  381. }
  382. if mmDelete.defaultExpectation.paramPtrs == nil {
  383. mmDelete.defaultExpectation.paramPtrs = &PlaceImageRepositoryMockDeleteParamPtrs{}
  384. }
  385. mmDelete.defaultExpectation.paramPtrs.ctx = &ctx
  386. return mmDelete
  387. }
  388. // ExpectIdParam2 sets up expected param id for PlaceImageRepository.Delete
  389. func (mmDelete *mPlaceImageRepositoryMockDelete) ExpectIdParam2(id uint64) *mPlaceImageRepositoryMockDelete {
  390. if mmDelete.mock.funcDelete != nil {
  391. mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by Set")
  392. }
  393. if mmDelete.defaultExpectation == nil {
  394. mmDelete.defaultExpectation = &PlaceImageRepositoryMockDeleteExpectation{}
  395. }
  396. if mmDelete.defaultExpectation.params != nil {
  397. mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by Expect")
  398. }
  399. if mmDelete.defaultExpectation.paramPtrs == nil {
  400. mmDelete.defaultExpectation.paramPtrs = &PlaceImageRepositoryMockDeleteParamPtrs{}
  401. }
  402. mmDelete.defaultExpectation.paramPtrs.id = &id
  403. return mmDelete
  404. }
  405. // Inspect accepts an inspector function that has same arguments as the PlaceImageRepository.Delete
  406. func (mmDelete *mPlaceImageRepositoryMockDelete) Inspect(f func(ctx context.Context, id uint64)) *mPlaceImageRepositoryMockDelete {
  407. if mmDelete.mock.inspectFuncDelete != nil {
  408. mmDelete.mock.t.Fatalf("Inspect function is already set for PlaceImageRepositoryMock.Delete")
  409. }
  410. mmDelete.mock.inspectFuncDelete = f
  411. return mmDelete
  412. }
  413. // Return sets up results that will be returned by PlaceImageRepository.Delete
  414. func (mmDelete *mPlaceImageRepositoryMockDelete) Return(err error) *PlaceImageRepositoryMock {
  415. if mmDelete.mock.funcDelete != nil {
  416. mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by Set")
  417. }
  418. if mmDelete.defaultExpectation == nil {
  419. mmDelete.defaultExpectation = &PlaceImageRepositoryMockDeleteExpectation{mock: mmDelete.mock}
  420. }
  421. mmDelete.defaultExpectation.results = &PlaceImageRepositoryMockDeleteResults{err}
  422. return mmDelete.mock
  423. }
  424. // Set uses given function f to mock the PlaceImageRepository.Delete method
  425. func (mmDelete *mPlaceImageRepositoryMockDelete) Set(f func(ctx context.Context, id uint64) (err error)) *PlaceImageRepositoryMock {
  426. if mmDelete.defaultExpectation != nil {
  427. mmDelete.mock.t.Fatalf("Default expectation is already set for the PlaceImageRepository.Delete method")
  428. }
  429. if len(mmDelete.expectations) > 0 {
  430. mmDelete.mock.t.Fatalf("Some expectations are already set for the PlaceImageRepository.Delete method")
  431. }
  432. mmDelete.mock.funcDelete = f
  433. return mmDelete.mock
  434. }
  435. // When sets expectation for the PlaceImageRepository.Delete which will trigger the result defined by the following
  436. // Then helper
  437. func (mmDelete *mPlaceImageRepositoryMockDelete) When(ctx context.Context, id uint64) *PlaceImageRepositoryMockDeleteExpectation {
  438. if mmDelete.mock.funcDelete != nil {
  439. mmDelete.mock.t.Fatalf("PlaceImageRepositoryMock.Delete mock is already set by Set")
  440. }
  441. expectation := &PlaceImageRepositoryMockDeleteExpectation{
  442. mock: mmDelete.mock,
  443. params: &PlaceImageRepositoryMockDeleteParams{ctx, id},
  444. }
  445. mmDelete.expectations = append(mmDelete.expectations, expectation)
  446. return expectation
  447. }
  448. // Then sets up PlaceImageRepository.Delete return parameters for the expectation previously defined by the When method
  449. func (e *PlaceImageRepositoryMockDeleteExpectation) Then(err error) *PlaceImageRepositoryMock {
  450. e.results = &PlaceImageRepositoryMockDeleteResults{err}
  451. return e.mock
  452. }
  453. // Times sets number of times PlaceImageRepository.Delete should be invoked
  454. func (mmDelete *mPlaceImageRepositoryMockDelete) Times(n uint64) *mPlaceImageRepositoryMockDelete {
  455. if n == 0 {
  456. mmDelete.mock.t.Fatalf("Times of PlaceImageRepositoryMock.Delete mock can not be zero")
  457. }
  458. mm_atomic.StoreUint64(&mmDelete.expectedInvocations, n)
  459. return mmDelete
  460. }
  461. func (mmDelete *mPlaceImageRepositoryMockDelete) invocationsDone() bool {
  462. if len(mmDelete.expectations) == 0 && mmDelete.defaultExpectation == nil && mmDelete.mock.funcDelete == nil {
  463. return true
  464. }
  465. totalInvocations := mm_atomic.LoadUint64(&mmDelete.mock.afterDeleteCounter)
  466. expectedInvocations := mm_atomic.LoadUint64(&mmDelete.expectedInvocations)
  467. return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
  468. }
  469. // Delete implements image.PlaceImageRepository
  470. func (mmDelete *PlaceImageRepositoryMock) Delete(ctx context.Context, id uint64) (err error) {
  471. mm_atomic.AddUint64(&mmDelete.beforeDeleteCounter, 1)
  472. defer mm_atomic.AddUint64(&mmDelete.afterDeleteCounter, 1)
  473. if mmDelete.inspectFuncDelete != nil {
  474. mmDelete.inspectFuncDelete(ctx, id)
  475. }
  476. mm_params := PlaceImageRepositoryMockDeleteParams{ctx, id}
  477. // Record call args
  478. mmDelete.DeleteMock.mutex.Lock()
  479. mmDelete.DeleteMock.callArgs = append(mmDelete.DeleteMock.callArgs, &mm_params)
  480. mmDelete.DeleteMock.mutex.Unlock()
  481. for _, e := range mmDelete.DeleteMock.expectations {
  482. if minimock.Equal(*e.params, mm_params) {
  483. mm_atomic.AddUint64(&e.Counter, 1)
  484. return e.results.err
  485. }
  486. }
  487. if mmDelete.DeleteMock.defaultExpectation != nil {
  488. mm_atomic.AddUint64(&mmDelete.DeleteMock.defaultExpectation.Counter, 1)
  489. mm_want := mmDelete.DeleteMock.defaultExpectation.params
  490. mm_want_ptrs := mmDelete.DeleteMock.defaultExpectation.paramPtrs
  491. mm_got := PlaceImageRepositoryMockDeleteParams{ctx, id}
  492. if mm_want_ptrs != nil {
  493. if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
  494. mmDelete.t.Errorf("PlaceImageRepositoryMock.Delete got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
  495. }
  496. if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
  497. mmDelete.t.Errorf("PlaceImageRepositoryMock.Delete got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
  498. }
  499. } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  500. mmDelete.t.Errorf("PlaceImageRepositoryMock.Delete got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  501. }
  502. mm_results := mmDelete.DeleteMock.defaultExpectation.results
  503. if mm_results == nil {
  504. mmDelete.t.Fatal("No results are set for the PlaceImageRepositoryMock.Delete")
  505. }
  506. return (*mm_results).err
  507. }
  508. if mmDelete.funcDelete != nil {
  509. return mmDelete.funcDelete(ctx, id)
  510. }
  511. mmDelete.t.Fatalf("Unexpected call to PlaceImageRepositoryMock.Delete. %v %v", ctx, id)
  512. return
  513. }
  514. // DeleteAfterCounter returns a count of finished PlaceImageRepositoryMock.Delete invocations
  515. func (mmDelete *PlaceImageRepositoryMock) DeleteAfterCounter() uint64 {
  516. return mm_atomic.LoadUint64(&mmDelete.afterDeleteCounter)
  517. }
  518. // DeleteBeforeCounter returns a count of PlaceImageRepositoryMock.Delete invocations
  519. func (mmDelete *PlaceImageRepositoryMock) DeleteBeforeCounter() uint64 {
  520. return mm_atomic.LoadUint64(&mmDelete.beforeDeleteCounter)
  521. }
  522. // Calls returns a list of arguments used in each call to PlaceImageRepositoryMock.Delete.
  523. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  524. func (mmDelete *mPlaceImageRepositoryMockDelete) Calls() []*PlaceImageRepositoryMockDeleteParams {
  525. mmDelete.mutex.RLock()
  526. argCopy := make([]*PlaceImageRepositoryMockDeleteParams, len(mmDelete.callArgs))
  527. copy(argCopy, mmDelete.callArgs)
  528. mmDelete.mutex.RUnlock()
  529. return argCopy
  530. }
  531. // MinimockDeleteDone returns true if the count of the Delete invocations corresponds
  532. // the number of defined expectations
  533. func (m *PlaceImageRepositoryMock) MinimockDeleteDone() bool {
  534. if m.DeleteMock.optional {
  535. // Optional methods provide '0 or more' call count restriction.
  536. return true
  537. }
  538. for _, e := range m.DeleteMock.expectations {
  539. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  540. return false
  541. }
  542. }
  543. return m.DeleteMock.invocationsDone()
  544. }
  545. // MinimockDeleteInspect logs each unmet expectation
  546. func (m *PlaceImageRepositoryMock) MinimockDeleteInspect() {
  547. for _, e := range m.DeleteMock.expectations {
  548. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  549. m.t.Errorf("Expected call to PlaceImageRepositoryMock.Delete with params: %#v", *e.params)
  550. }
  551. }
  552. afterDeleteCounter := mm_atomic.LoadUint64(&m.afterDeleteCounter)
  553. // if default expectation was set then invocations count should be greater than zero
  554. if m.DeleteMock.defaultExpectation != nil && afterDeleteCounter < 1 {
  555. if m.DeleteMock.defaultExpectation.params == nil {
  556. m.t.Error("Expected call to PlaceImageRepositoryMock.Delete")
  557. } else {
  558. m.t.Errorf("Expected call to PlaceImageRepositoryMock.Delete with params: %#v", *m.DeleteMock.defaultExpectation.params)
  559. }
  560. }
  561. // if func was set then invocations count should be greater than zero
  562. if m.funcDelete != nil && afterDeleteCounter < 1 {
  563. m.t.Error("Expected call to PlaceImageRepositoryMock.Delete")
  564. }
  565. if !m.DeleteMock.invocationsDone() && afterDeleteCounter > 0 {
  566. m.t.Errorf("Expected %d calls to PlaceImageRepositoryMock.Delete but found %d calls",
  567. mm_atomic.LoadUint64(&m.DeleteMock.expectedInvocations), afterDeleteCounter)
  568. }
  569. }
  570. type mPlaceImageRepositoryMockGet struct {
  571. optional bool
  572. mock *PlaceImageRepositoryMock
  573. defaultExpectation *PlaceImageRepositoryMockGetExpectation
  574. expectations []*PlaceImageRepositoryMockGetExpectation
  575. callArgs []*PlaceImageRepositoryMockGetParams
  576. mutex sync.RWMutex
  577. expectedInvocations uint64
  578. }
  579. // PlaceImageRepositoryMockGetExpectation specifies expectation struct of the PlaceImageRepository.Get
  580. type PlaceImageRepositoryMockGetExpectation struct {
  581. mock *PlaceImageRepositoryMock
  582. params *PlaceImageRepositoryMockGetParams
  583. paramPtrs *PlaceImageRepositoryMockGetParamPtrs
  584. results *PlaceImageRepositoryMockGetResults
  585. Counter uint64
  586. }
  587. // PlaceImageRepositoryMockGetParams contains parameters of the PlaceImageRepository.Get
  588. type PlaceImageRepositoryMockGetParams struct {
  589. ctx context.Context
  590. id uint64
  591. }
  592. // PlaceImageRepositoryMockGetParamPtrs contains pointers to parameters of the PlaceImageRepository.Get
  593. type PlaceImageRepositoryMockGetParamPtrs struct {
  594. ctx *context.Context
  595. id *uint64
  596. }
  597. // PlaceImageRepositoryMockGetResults contains results of the PlaceImageRepository.Get
  598. type PlaceImageRepositoryMockGetResults struct {
  599. ip1 *models.Image
  600. err error
  601. }
  602. // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
  603. // the test will fail minimock's automatic final call check if the mocked method was not called at least once.
  604. // Optional() makes method check to work in '0 or more' mode.
  605. // It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
  606. // catch the problems when the expected method call is totally skipped during test run.
  607. func (mmGet *mPlaceImageRepositoryMockGet) Optional() *mPlaceImageRepositoryMockGet {
  608. mmGet.optional = true
  609. return mmGet
  610. }
  611. // Expect sets up expected params for PlaceImageRepository.Get
  612. func (mmGet *mPlaceImageRepositoryMockGet) Expect(ctx context.Context, id uint64) *mPlaceImageRepositoryMockGet {
  613. if mmGet.mock.funcGet != nil {
  614. mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by Set")
  615. }
  616. if mmGet.defaultExpectation == nil {
  617. mmGet.defaultExpectation = &PlaceImageRepositoryMockGetExpectation{}
  618. }
  619. if mmGet.defaultExpectation.paramPtrs != nil {
  620. mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by ExpectParams functions")
  621. }
  622. mmGet.defaultExpectation.params = &PlaceImageRepositoryMockGetParams{ctx, id}
  623. for _, e := range mmGet.expectations {
  624. if minimock.Equal(e.params, mmGet.defaultExpectation.params) {
  625. mmGet.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGet.defaultExpectation.params)
  626. }
  627. }
  628. return mmGet
  629. }
  630. // ExpectCtxParam1 sets up expected param ctx for PlaceImageRepository.Get
  631. func (mmGet *mPlaceImageRepositoryMockGet) ExpectCtxParam1(ctx context.Context) *mPlaceImageRepositoryMockGet {
  632. if mmGet.mock.funcGet != nil {
  633. mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by Set")
  634. }
  635. if mmGet.defaultExpectation == nil {
  636. mmGet.defaultExpectation = &PlaceImageRepositoryMockGetExpectation{}
  637. }
  638. if mmGet.defaultExpectation.params != nil {
  639. mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by Expect")
  640. }
  641. if mmGet.defaultExpectation.paramPtrs == nil {
  642. mmGet.defaultExpectation.paramPtrs = &PlaceImageRepositoryMockGetParamPtrs{}
  643. }
  644. mmGet.defaultExpectation.paramPtrs.ctx = &ctx
  645. return mmGet
  646. }
  647. // ExpectIdParam2 sets up expected param id for PlaceImageRepository.Get
  648. func (mmGet *mPlaceImageRepositoryMockGet) ExpectIdParam2(id uint64) *mPlaceImageRepositoryMockGet {
  649. if mmGet.mock.funcGet != nil {
  650. mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by Set")
  651. }
  652. if mmGet.defaultExpectation == nil {
  653. mmGet.defaultExpectation = &PlaceImageRepositoryMockGetExpectation{}
  654. }
  655. if mmGet.defaultExpectation.params != nil {
  656. mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by Expect")
  657. }
  658. if mmGet.defaultExpectation.paramPtrs == nil {
  659. mmGet.defaultExpectation.paramPtrs = &PlaceImageRepositoryMockGetParamPtrs{}
  660. }
  661. mmGet.defaultExpectation.paramPtrs.id = &id
  662. return mmGet
  663. }
  664. // Inspect accepts an inspector function that has same arguments as the PlaceImageRepository.Get
  665. func (mmGet *mPlaceImageRepositoryMockGet) Inspect(f func(ctx context.Context, id uint64)) *mPlaceImageRepositoryMockGet {
  666. if mmGet.mock.inspectFuncGet != nil {
  667. mmGet.mock.t.Fatalf("Inspect function is already set for PlaceImageRepositoryMock.Get")
  668. }
  669. mmGet.mock.inspectFuncGet = f
  670. return mmGet
  671. }
  672. // Return sets up results that will be returned by PlaceImageRepository.Get
  673. func (mmGet *mPlaceImageRepositoryMockGet) Return(ip1 *models.Image, err error) *PlaceImageRepositoryMock {
  674. if mmGet.mock.funcGet != nil {
  675. mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by Set")
  676. }
  677. if mmGet.defaultExpectation == nil {
  678. mmGet.defaultExpectation = &PlaceImageRepositoryMockGetExpectation{mock: mmGet.mock}
  679. }
  680. mmGet.defaultExpectation.results = &PlaceImageRepositoryMockGetResults{ip1, err}
  681. return mmGet.mock
  682. }
  683. // Set uses given function f to mock the PlaceImageRepository.Get method
  684. func (mmGet *mPlaceImageRepositoryMockGet) Set(f func(ctx context.Context, id uint64) (ip1 *models.Image, err error)) *PlaceImageRepositoryMock {
  685. if mmGet.defaultExpectation != nil {
  686. mmGet.mock.t.Fatalf("Default expectation is already set for the PlaceImageRepository.Get method")
  687. }
  688. if len(mmGet.expectations) > 0 {
  689. mmGet.mock.t.Fatalf("Some expectations are already set for the PlaceImageRepository.Get method")
  690. }
  691. mmGet.mock.funcGet = f
  692. return mmGet.mock
  693. }
  694. // When sets expectation for the PlaceImageRepository.Get which will trigger the result defined by the following
  695. // Then helper
  696. func (mmGet *mPlaceImageRepositoryMockGet) When(ctx context.Context, id uint64) *PlaceImageRepositoryMockGetExpectation {
  697. if mmGet.mock.funcGet != nil {
  698. mmGet.mock.t.Fatalf("PlaceImageRepositoryMock.Get mock is already set by Set")
  699. }
  700. expectation := &PlaceImageRepositoryMockGetExpectation{
  701. mock: mmGet.mock,
  702. params: &PlaceImageRepositoryMockGetParams{ctx, id},
  703. }
  704. mmGet.expectations = append(mmGet.expectations, expectation)
  705. return expectation
  706. }
  707. // Then sets up PlaceImageRepository.Get return parameters for the expectation previously defined by the When method
  708. func (e *PlaceImageRepositoryMockGetExpectation) Then(ip1 *models.Image, err error) *PlaceImageRepositoryMock {
  709. e.results = &PlaceImageRepositoryMockGetResults{ip1, err}
  710. return e.mock
  711. }
  712. // Times sets number of times PlaceImageRepository.Get should be invoked
  713. func (mmGet *mPlaceImageRepositoryMockGet) Times(n uint64) *mPlaceImageRepositoryMockGet {
  714. if n == 0 {
  715. mmGet.mock.t.Fatalf("Times of PlaceImageRepositoryMock.Get mock can not be zero")
  716. }
  717. mm_atomic.StoreUint64(&mmGet.expectedInvocations, n)
  718. return mmGet
  719. }
  720. func (mmGet *mPlaceImageRepositoryMockGet) invocationsDone() bool {
  721. if len(mmGet.expectations) == 0 && mmGet.defaultExpectation == nil && mmGet.mock.funcGet == nil {
  722. return true
  723. }
  724. totalInvocations := mm_atomic.LoadUint64(&mmGet.mock.afterGetCounter)
  725. expectedInvocations := mm_atomic.LoadUint64(&mmGet.expectedInvocations)
  726. return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
  727. }
  728. // Get implements image.PlaceImageRepository
  729. func (mmGet *PlaceImageRepositoryMock) Get(ctx context.Context, id uint64) (ip1 *models.Image, err error) {
  730. mm_atomic.AddUint64(&mmGet.beforeGetCounter, 1)
  731. defer mm_atomic.AddUint64(&mmGet.afterGetCounter, 1)
  732. if mmGet.inspectFuncGet != nil {
  733. mmGet.inspectFuncGet(ctx, id)
  734. }
  735. mm_params := PlaceImageRepositoryMockGetParams{ctx, id}
  736. // Record call args
  737. mmGet.GetMock.mutex.Lock()
  738. mmGet.GetMock.callArgs = append(mmGet.GetMock.callArgs, &mm_params)
  739. mmGet.GetMock.mutex.Unlock()
  740. for _, e := range mmGet.GetMock.expectations {
  741. if minimock.Equal(*e.params, mm_params) {
  742. mm_atomic.AddUint64(&e.Counter, 1)
  743. return e.results.ip1, e.results.err
  744. }
  745. }
  746. if mmGet.GetMock.defaultExpectation != nil {
  747. mm_atomic.AddUint64(&mmGet.GetMock.defaultExpectation.Counter, 1)
  748. mm_want := mmGet.GetMock.defaultExpectation.params
  749. mm_want_ptrs := mmGet.GetMock.defaultExpectation.paramPtrs
  750. mm_got := PlaceImageRepositoryMockGetParams{ctx, id}
  751. if mm_want_ptrs != nil {
  752. if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
  753. mmGet.t.Errorf("PlaceImageRepositoryMock.Get got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
  754. }
  755. if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
  756. mmGet.t.Errorf("PlaceImageRepositoryMock.Get got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
  757. }
  758. } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  759. mmGet.t.Errorf("PlaceImageRepositoryMock.Get got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  760. }
  761. mm_results := mmGet.GetMock.defaultExpectation.results
  762. if mm_results == nil {
  763. mmGet.t.Fatal("No results are set for the PlaceImageRepositoryMock.Get")
  764. }
  765. return (*mm_results).ip1, (*mm_results).err
  766. }
  767. if mmGet.funcGet != nil {
  768. return mmGet.funcGet(ctx, id)
  769. }
  770. mmGet.t.Fatalf("Unexpected call to PlaceImageRepositoryMock.Get. %v %v", ctx, id)
  771. return
  772. }
  773. // GetAfterCounter returns a count of finished PlaceImageRepositoryMock.Get invocations
  774. func (mmGet *PlaceImageRepositoryMock) GetAfterCounter() uint64 {
  775. return mm_atomic.LoadUint64(&mmGet.afterGetCounter)
  776. }
  777. // GetBeforeCounter returns a count of PlaceImageRepositoryMock.Get invocations
  778. func (mmGet *PlaceImageRepositoryMock) GetBeforeCounter() uint64 {
  779. return mm_atomic.LoadUint64(&mmGet.beforeGetCounter)
  780. }
  781. // Calls returns a list of arguments used in each call to PlaceImageRepositoryMock.Get.
  782. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  783. func (mmGet *mPlaceImageRepositoryMockGet) Calls() []*PlaceImageRepositoryMockGetParams {
  784. mmGet.mutex.RLock()
  785. argCopy := make([]*PlaceImageRepositoryMockGetParams, len(mmGet.callArgs))
  786. copy(argCopy, mmGet.callArgs)
  787. mmGet.mutex.RUnlock()
  788. return argCopy
  789. }
  790. // MinimockGetDone returns true if the count of the Get invocations corresponds
  791. // the number of defined expectations
  792. func (m *PlaceImageRepositoryMock) MinimockGetDone() bool {
  793. if m.GetMock.optional {
  794. // Optional methods provide '0 or more' call count restriction.
  795. return true
  796. }
  797. for _, e := range m.GetMock.expectations {
  798. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  799. return false
  800. }
  801. }
  802. return m.GetMock.invocationsDone()
  803. }
  804. // MinimockGetInspect logs each unmet expectation
  805. func (m *PlaceImageRepositoryMock) MinimockGetInspect() {
  806. for _, e := range m.GetMock.expectations {
  807. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  808. m.t.Errorf("Expected call to PlaceImageRepositoryMock.Get with params: %#v", *e.params)
  809. }
  810. }
  811. afterGetCounter := mm_atomic.LoadUint64(&m.afterGetCounter)
  812. // if default expectation was set then invocations count should be greater than zero
  813. if m.GetMock.defaultExpectation != nil && afterGetCounter < 1 {
  814. if m.GetMock.defaultExpectation.params == nil {
  815. m.t.Error("Expected call to PlaceImageRepositoryMock.Get")
  816. } else {
  817. m.t.Errorf("Expected call to PlaceImageRepositoryMock.Get with params: %#v", *m.GetMock.defaultExpectation.params)
  818. }
  819. }
  820. // if func was set then invocations count should be greater than zero
  821. if m.funcGet != nil && afterGetCounter < 1 {
  822. m.t.Error("Expected call to PlaceImageRepositoryMock.Get")
  823. }
  824. if !m.GetMock.invocationsDone() && afterGetCounter > 0 {
  825. m.t.Errorf("Expected %d calls to PlaceImageRepositoryMock.Get but found %d calls",
  826. mm_atomic.LoadUint64(&m.GetMock.expectedInvocations), afterGetCounter)
  827. }
  828. }
  829. type mPlaceImageRepositoryMockGetByPlaceID struct {
  830. optional bool
  831. mock *PlaceImageRepositoryMock
  832. defaultExpectation *PlaceImageRepositoryMockGetByPlaceIDExpectation
  833. expectations []*PlaceImageRepositoryMockGetByPlaceIDExpectation
  834. callArgs []*PlaceImageRepositoryMockGetByPlaceIDParams
  835. mutex sync.RWMutex
  836. expectedInvocations uint64
  837. }
  838. // PlaceImageRepositoryMockGetByPlaceIDExpectation specifies expectation struct of the PlaceImageRepository.GetByPlaceID
  839. type PlaceImageRepositoryMockGetByPlaceIDExpectation struct {
  840. mock *PlaceImageRepositoryMock
  841. params *PlaceImageRepositoryMockGetByPlaceIDParams
  842. paramPtrs *PlaceImageRepositoryMockGetByPlaceIDParamPtrs
  843. results *PlaceImageRepositoryMockGetByPlaceIDResults
  844. Counter uint64
  845. }
  846. // PlaceImageRepositoryMockGetByPlaceIDParams contains parameters of the PlaceImageRepository.GetByPlaceID
  847. type PlaceImageRepositoryMockGetByPlaceIDParams struct {
  848. ctx context.Context
  849. id uint64
  850. }
  851. // PlaceImageRepositoryMockGetByPlaceIDParamPtrs contains pointers to parameters of the PlaceImageRepository.GetByPlaceID
  852. type PlaceImageRepositoryMockGetByPlaceIDParamPtrs struct {
  853. ctx *context.Context
  854. id *uint64
  855. }
  856. // PlaceImageRepositoryMockGetByPlaceIDResults contains results of the PlaceImageRepository.GetByPlaceID
  857. type PlaceImageRepositoryMockGetByPlaceIDResults struct {
  858. ia1 []models.Image
  859. err error
  860. }
  861. // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
  862. // the test will fail minimock's automatic final call check if the mocked method was not called at least once.
  863. // Optional() makes method check to work in '0 or more' mode.
  864. // It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
  865. // catch the problems when the expected method call is totally skipped during test run.
  866. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Optional() *mPlaceImageRepositoryMockGetByPlaceID {
  867. mmGetByPlaceID.optional = true
  868. return mmGetByPlaceID
  869. }
  870. // Expect sets up expected params for PlaceImageRepository.GetByPlaceID
  871. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Expect(ctx context.Context, id uint64) *mPlaceImageRepositoryMockGetByPlaceID {
  872. if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
  873. mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by Set")
  874. }
  875. if mmGetByPlaceID.defaultExpectation == nil {
  876. mmGetByPlaceID.defaultExpectation = &PlaceImageRepositoryMockGetByPlaceIDExpectation{}
  877. }
  878. if mmGetByPlaceID.defaultExpectation.paramPtrs != nil {
  879. mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by ExpectParams functions")
  880. }
  881. mmGetByPlaceID.defaultExpectation.params = &PlaceImageRepositoryMockGetByPlaceIDParams{ctx, id}
  882. for _, e := range mmGetByPlaceID.expectations {
  883. if minimock.Equal(e.params, mmGetByPlaceID.defaultExpectation.params) {
  884. mmGetByPlaceID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByPlaceID.defaultExpectation.params)
  885. }
  886. }
  887. return mmGetByPlaceID
  888. }
  889. // ExpectCtxParam1 sets up expected param ctx for PlaceImageRepository.GetByPlaceID
  890. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) ExpectCtxParam1(ctx context.Context) *mPlaceImageRepositoryMockGetByPlaceID {
  891. if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
  892. mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by Set")
  893. }
  894. if mmGetByPlaceID.defaultExpectation == nil {
  895. mmGetByPlaceID.defaultExpectation = &PlaceImageRepositoryMockGetByPlaceIDExpectation{}
  896. }
  897. if mmGetByPlaceID.defaultExpectation.params != nil {
  898. mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by Expect")
  899. }
  900. if mmGetByPlaceID.defaultExpectation.paramPtrs == nil {
  901. mmGetByPlaceID.defaultExpectation.paramPtrs = &PlaceImageRepositoryMockGetByPlaceIDParamPtrs{}
  902. }
  903. mmGetByPlaceID.defaultExpectation.paramPtrs.ctx = &ctx
  904. return mmGetByPlaceID
  905. }
  906. // ExpectIdParam2 sets up expected param id for PlaceImageRepository.GetByPlaceID
  907. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) ExpectIdParam2(id uint64) *mPlaceImageRepositoryMockGetByPlaceID {
  908. if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
  909. mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by Set")
  910. }
  911. if mmGetByPlaceID.defaultExpectation == nil {
  912. mmGetByPlaceID.defaultExpectation = &PlaceImageRepositoryMockGetByPlaceIDExpectation{}
  913. }
  914. if mmGetByPlaceID.defaultExpectation.params != nil {
  915. mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by Expect")
  916. }
  917. if mmGetByPlaceID.defaultExpectation.paramPtrs == nil {
  918. mmGetByPlaceID.defaultExpectation.paramPtrs = &PlaceImageRepositoryMockGetByPlaceIDParamPtrs{}
  919. }
  920. mmGetByPlaceID.defaultExpectation.paramPtrs.id = &id
  921. return mmGetByPlaceID
  922. }
  923. // Inspect accepts an inspector function that has same arguments as the PlaceImageRepository.GetByPlaceID
  924. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Inspect(f func(ctx context.Context, id uint64)) *mPlaceImageRepositoryMockGetByPlaceID {
  925. if mmGetByPlaceID.mock.inspectFuncGetByPlaceID != nil {
  926. mmGetByPlaceID.mock.t.Fatalf("Inspect function is already set for PlaceImageRepositoryMock.GetByPlaceID")
  927. }
  928. mmGetByPlaceID.mock.inspectFuncGetByPlaceID = f
  929. return mmGetByPlaceID
  930. }
  931. // Return sets up results that will be returned by PlaceImageRepository.GetByPlaceID
  932. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Return(ia1 []models.Image, err error) *PlaceImageRepositoryMock {
  933. if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
  934. mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by Set")
  935. }
  936. if mmGetByPlaceID.defaultExpectation == nil {
  937. mmGetByPlaceID.defaultExpectation = &PlaceImageRepositoryMockGetByPlaceIDExpectation{mock: mmGetByPlaceID.mock}
  938. }
  939. mmGetByPlaceID.defaultExpectation.results = &PlaceImageRepositoryMockGetByPlaceIDResults{ia1, err}
  940. return mmGetByPlaceID.mock
  941. }
  942. // Set uses given function f to mock the PlaceImageRepository.GetByPlaceID method
  943. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Set(f func(ctx context.Context, id uint64) (ia1 []models.Image, err error)) *PlaceImageRepositoryMock {
  944. if mmGetByPlaceID.defaultExpectation != nil {
  945. mmGetByPlaceID.mock.t.Fatalf("Default expectation is already set for the PlaceImageRepository.GetByPlaceID method")
  946. }
  947. if len(mmGetByPlaceID.expectations) > 0 {
  948. mmGetByPlaceID.mock.t.Fatalf("Some expectations are already set for the PlaceImageRepository.GetByPlaceID method")
  949. }
  950. mmGetByPlaceID.mock.funcGetByPlaceID = f
  951. return mmGetByPlaceID.mock
  952. }
  953. // When sets expectation for the PlaceImageRepository.GetByPlaceID which will trigger the result defined by the following
  954. // Then helper
  955. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) When(ctx context.Context, id uint64) *PlaceImageRepositoryMockGetByPlaceIDExpectation {
  956. if mmGetByPlaceID.mock.funcGetByPlaceID != nil {
  957. mmGetByPlaceID.mock.t.Fatalf("PlaceImageRepositoryMock.GetByPlaceID mock is already set by Set")
  958. }
  959. expectation := &PlaceImageRepositoryMockGetByPlaceIDExpectation{
  960. mock: mmGetByPlaceID.mock,
  961. params: &PlaceImageRepositoryMockGetByPlaceIDParams{ctx, id},
  962. }
  963. mmGetByPlaceID.expectations = append(mmGetByPlaceID.expectations, expectation)
  964. return expectation
  965. }
  966. // Then sets up PlaceImageRepository.GetByPlaceID return parameters for the expectation previously defined by the When method
  967. func (e *PlaceImageRepositoryMockGetByPlaceIDExpectation) Then(ia1 []models.Image, err error) *PlaceImageRepositoryMock {
  968. e.results = &PlaceImageRepositoryMockGetByPlaceIDResults{ia1, err}
  969. return e.mock
  970. }
  971. // Times sets number of times PlaceImageRepository.GetByPlaceID should be invoked
  972. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Times(n uint64) *mPlaceImageRepositoryMockGetByPlaceID {
  973. if n == 0 {
  974. mmGetByPlaceID.mock.t.Fatalf("Times of PlaceImageRepositoryMock.GetByPlaceID mock can not be zero")
  975. }
  976. mm_atomic.StoreUint64(&mmGetByPlaceID.expectedInvocations, n)
  977. return mmGetByPlaceID
  978. }
  979. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) invocationsDone() bool {
  980. if len(mmGetByPlaceID.expectations) == 0 && mmGetByPlaceID.defaultExpectation == nil && mmGetByPlaceID.mock.funcGetByPlaceID == nil {
  981. return true
  982. }
  983. totalInvocations := mm_atomic.LoadUint64(&mmGetByPlaceID.mock.afterGetByPlaceIDCounter)
  984. expectedInvocations := mm_atomic.LoadUint64(&mmGetByPlaceID.expectedInvocations)
  985. return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
  986. }
  987. // GetByPlaceID implements image.PlaceImageRepository
  988. func (mmGetByPlaceID *PlaceImageRepositoryMock) GetByPlaceID(ctx context.Context, id uint64) (ia1 []models.Image, err error) {
  989. mm_atomic.AddUint64(&mmGetByPlaceID.beforeGetByPlaceIDCounter, 1)
  990. defer mm_atomic.AddUint64(&mmGetByPlaceID.afterGetByPlaceIDCounter, 1)
  991. if mmGetByPlaceID.inspectFuncGetByPlaceID != nil {
  992. mmGetByPlaceID.inspectFuncGetByPlaceID(ctx, id)
  993. }
  994. mm_params := PlaceImageRepositoryMockGetByPlaceIDParams{ctx, id}
  995. // Record call args
  996. mmGetByPlaceID.GetByPlaceIDMock.mutex.Lock()
  997. mmGetByPlaceID.GetByPlaceIDMock.callArgs = append(mmGetByPlaceID.GetByPlaceIDMock.callArgs, &mm_params)
  998. mmGetByPlaceID.GetByPlaceIDMock.mutex.Unlock()
  999. for _, e := range mmGetByPlaceID.GetByPlaceIDMock.expectations {
  1000. if minimock.Equal(*e.params, mm_params) {
  1001. mm_atomic.AddUint64(&e.Counter, 1)
  1002. return e.results.ia1, e.results.err
  1003. }
  1004. }
  1005. if mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation != nil {
  1006. mm_atomic.AddUint64(&mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.Counter, 1)
  1007. mm_want := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.params
  1008. mm_want_ptrs := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.paramPtrs
  1009. mm_got := PlaceImageRepositoryMockGetByPlaceIDParams{ctx, id}
  1010. if mm_want_ptrs != nil {
  1011. if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
  1012. mmGetByPlaceID.t.Errorf("PlaceImageRepositoryMock.GetByPlaceID got unexpected parameter ctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
  1013. }
  1014. if mm_want_ptrs.id != nil && !minimock.Equal(*mm_want_ptrs.id, mm_got.id) {
  1015. mmGetByPlaceID.t.Errorf("PlaceImageRepositoryMock.GetByPlaceID got unexpected parameter id, want: %#v, got: %#v%s\n", *mm_want_ptrs.id, mm_got.id, minimock.Diff(*mm_want_ptrs.id, mm_got.id))
  1016. }
  1017. } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  1018. mmGetByPlaceID.t.Errorf("PlaceImageRepositoryMock.GetByPlaceID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  1019. }
  1020. mm_results := mmGetByPlaceID.GetByPlaceIDMock.defaultExpectation.results
  1021. if mm_results == nil {
  1022. mmGetByPlaceID.t.Fatal("No results are set for the PlaceImageRepositoryMock.GetByPlaceID")
  1023. }
  1024. return (*mm_results).ia1, (*mm_results).err
  1025. }
  1026. if mmGetByPlaceID.funcGetByPlaceID != nil {
  1027. return mmGetByPlaceID.funcGetByPlaceID(ctx, id)
  1028. }
  1029. mmGetByPlaceID.t.Fatalf("Unexpected call to PlaceImageRepositoryMock.GetByPlaceID. %v %v", ctx, id)
  1030. return
  1031. }
  1032. // GetByPlaceIDAfterCounter returns a count of finished PlaceImageRepositoryMock.GetByPlaceID invocations
  1033. func (mmGetByPlaceID *PlaceImageRepositoryMock) GetByPlaceIDAfterCounter() uint64 {
  1034. return mm_atomic.LoadUint64(&mmGetByPlaceID.afterGetByPlaceIDCounter)
  1035. }
  1036. // GetByPlaceIDBeforeCounter returns a count of PlaceImageRepositoryMock.GetByPlaceID invocations
  1037. func (mmGetByPlaceID *PlaceImageRepositoryMock) GetByPlaceIDBeforeCounter() uint64 {
  1038. return mm_atomic.LoadUint64(&mmGetByPlaceID.beforeGetByPlaceIDCounter)
  1039. }
  1040. // Calls returns a list of arguments used in each call to PlaceImageRepositoryMock.GetByPlaceID.
  1041. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  1042. func (mmGetByPlaceID *mPlaceImageRepositoryMockGetByPlaceID) Calls() []*PlaceImageRepositoryMockGetByPlaceIDParams {
  1043. mmGetByPlaceID.mutex.RLock()
  1044. argCopy := make([]*PlaceImageRepositoryMockGetByPlaceIDParams, len(mmGetByPlaceID.callArgs))
  1045. copy(argCopy, mmGetByPlaceID.callArgs)
  1046. mmGetByPlaceID.mutex.RUnlock()
  1047. return argCopy
  1048. }
  1049. // MinimockGetByPlaceIDDone returns true if the count of the GetByPlaceID invocations corresponds
  1050. // the number of defined expectations
  1051. func (m *PlaceImageRepositoryMock) MinimockGetByPlaceIDDone() bool {
  1052. if m.GetByPlaceIDMock.optional {
  1053. // Optional methods provide '0 or more' call count restriction.
  1054. return true
  1055. }
  1056. for _, e := range m.GetByPlaceIDMock.expectations {
  1057. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  1058. return false
  1059. }
  1060. }
  1061. return m.GetByPlaceIDMock.invocationsDone()
  1062. }
  1063. // MinimockGetByPlaceIDInspect logs each unmet expectation
  1064. func (m *PlaceImageRepositoryMock) MinimockGetByPlaceIDInspect() {
  1065. for _, e := range m.GetByPlaceIDMock.expectations {
  1066. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  1067. m.t.Errorf("Expected call to PlaceImageRepositoryMock.GetByPlaceID with params: %#v", *e.params)
  1068. }
  1069. }
  1070. afterGetByPlaceIDCounter := mm_atomic.LoadUint64(&m.afterGetByPlaceIDCounter)
  1071. // if default expectation was set then invocations count should be greater than zero
  1072. if m.GetByPlaceIDMock.defaultExpectation != nil && afterGetByPlaceIDCounter < 1 {
  1073. if m.GetByPlaceIDMock.defaultExpectation.params == nil {
  1074. m.t.Error("Expected call to PlaceImageRepositoryMock.GetByPlaceID")
  1075. } else {
  1076. m.t.Errorf("Expected call to PlaceImageRepositoryMock.GetByPlaceID with params: %#v", *m.GetByPlaceIDMock.defaultExpectation.params)
  1077. }
  1078. }
  1079. // if func was set then invocations count should be greater than zero
  1080. if m.funcGetByPlaceID != nil && afterGetByPlaceIDCounter < 1 {
  1081. m.t.Error("Expected call to PlaceImageRepositoryMock.GetByPlaceID")
  1082. }
  1083. if !m.GetByPlaceIDMock.invocationsDone() && afterGetByPlaceIDCounter > 0 {
  1084. m.t.Errorf("Expected %d calls to PlaceImageRepositoryMock.GetByPlaceID but found %d calls",
  1085. mm_atomic.LoadUint64(&m.GetByPlaceIDMock.expectedInvocations), afterGetByPlaceIDCounter)
  1086. }
  1087. }
  1088. // MinimockFinish checks that all mocked methods have been called the expected number of times
  1089. func (m *PlaceImageRepositoryMock) MinimockFinish() {
  1090. m.finishOnce.Do(func() {
  1091. if !m.minimockDone() {
  1092. m.MinimockAddInspect()
  1093. m.MinimockDeleteInspect()
  1094. m.MinimockGetInspect()
  1095. m.MinimockGetByPlaceIDInspect()
  1096. }
  1097. })
  1098. }
  1099. // MinimockWait waits for all mocked methods to be called the expected number of times
  1100. func (m *PlaceImageRepositoryMock) MinimockWait(timeout mm_time.Duration) {
  1101. timeoutCh := mm_time.After(timeout)
  1102. for {
  1103. if m.minimockDone() {
  1104. return
  1105. }
  1106. select {
  1107. case <-timeoutCh:
  1108. m.MinimockFinish()
  1109. return
  1110. case <-mm_time.After(10 * mm_time.Millisecond):
  1111. }
  1112. }
  1113. }
  1114. func (m *PlaceImageRepositoryMock) minimockDone() bool {
  1115. done := true
  1116. return done &&
  1117. m.MinimockAddDone() &&
  1118. m.MinimockDeleteDone() &&
  1119. m.MinimockGetDone() &&
  1120. m.MinimockGetByPlaceIDDone()
  1121. }