place_image_repository_minimock.go 54 KB

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