place_thing_repository_minimock.go 56 KB

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