place_thing_repository_minimock.go 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974
  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.PlaceThingRepository -o ./mocks/place_thing_repository_minimock.go -n PlaceThingRepositoryMock
  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. // PlaceThingRepositoryMock implements interfaces.PlaceThingRepository
  14. type PlaceThingRepositoryMock struct {
  15. t minimock.Tester
  16. funcAdd func(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx) (err error)
  17. inspectFuncAdd func(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx)
  18. afterAddCounter uint64
  19. beforeAddCounter uint64
  20. AddMock mPlaceThingRepositoryMockAdd
  21. funcDeleteThing func(ctx context.Context, thingID int, tx *sql.Tx) (err error)
  22. inspectFuncDeleteThing func(ctx context.Context, thingID int, tx *sql.Tx)
  23. afterDeleteThingCounter uint64
  24. beforeDeleteThingCounter uint64
  25. DeleteThingMock mPlaceThingRepositoryMockDeleteThing
  26. funcGetByThingID func(ctx context.Context, thingID int) (pp1 *models.PlaceThing, err error)
  27. inspectFuncGetByThingID func(ctx context.Context, thingID int)
  28. afterGetByThingIDCounter uint64
  29. beforeGetByThingIDCounter uint64
  30. GetByThingIDMock mPlaceThingRepositoryMockGetByThingID
  31. funcUpdatePlace func(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx) (err error)
  32. inspectFuncUpdatePlace func(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx)
  33. afterUpdatePlaceCounter uint64
  34. beforeUpdatePlaceCounter uint64
  35. UpdatePlaceMock mPlaceThingRepositoryMockUpdatePlace
  36. }
  37. // NewPlaceThingRepositoryMock returns a mock for interfaces.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. return m
  52. }
  53. type mPlaceThingRepositoryMockAdd struct {
  54. mock *PlaceThingRepositoryMock
  55. defaultExpectation *PlaceThingRepositoryMockAddExpectation
  56. expectations []*PlaceThingRepositoryMockAddExpectation
  57. callArgs []*PlaceThingRepositoryMockAddParams
  58. mutex sync.RWMutex
  59. }
  60. // PlaceThingRepositoryMockAddExpectation specifies expectation struct of the PlaceThingRepository.Add
  61. type PlaceThingRepositoryMockAddExpectation struct {
  62. mock *PlaceThingRepositoryMock
  63. params *PlaceThingRepositoryMockAddParams
  64. results *PlaceThingRepositoryMockAddResults
  65. Counter uint64
  66. }
  67. // PlaceThingRepositoryMockAddParams contains parameters of the PlaceThingRepository.Add
  68. type PlaceThingRepositoryMockAddParams struct {
  69. ctx context.Context
  70. req models.AddPlaceThingRequest
  71. tx *sql.Tx
  72. }
  73. // PlaceThingRepositoryMockAddResults contains results of the PlaceThingRepository.Add
  74. type PlaceThingRepositoryMockAddResults struct {
  75. err error
  76. }
  77. // Expect sets up expected params for PlaceThingRepository.Add
  78. func (mmAdd *mPlaceThingRepositoryMockAdd) Expect(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx) *mPlaceThingRepositoryMockAdd {
  79. if mmAdd.mock.funcAdd != nil {
  80. mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Set")
  81. }
  82. if mmAdd.defaultExpectation == nil {
  83. mmAdd.defaultExpectation = &PlaceThingRepositoryMockAddExpectation{}
  84. }
  85. mmAdd.defaultExpectation.params = &PlaceThingRepositoryMockAddParams{ctx, req, tx}
  86. for _, e := range mmAdd.expectations {
  87. if minimock.Equal(e.params, mmAdd.defaultExpectation.params) {
  88. mmAdd.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmAdd.defaultExpectation.params)
  89. }
  90. }
  91. return mmAdd
  92. }
  93. // Inspect accepts an inspector function that has same arguments as the PlaceThingRepository.Add
  94. func (mmAdd *mPlaceThingRepositoryMockAdd) Inspect(f func(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx)) *mPlaceThingRepositoryMockAdd {
  95. if mmAdd.mock.inspectFuncAdd != nil {
  96. mmAdd.mock.t.Fatalf("Inspect function is already set for PlaceThingRepositoryMock.Add")
  97. }
  98. mmAdd.mock.inspectFuncAdd = f
  99. return mmAdd
  100. }
  101. // Return sets up results that will be returned by PlaceThingRepository.Add
  102. func (mmAdd *mPlaceThingRepositoryMockAdd) Return(err error) *PlaceThingRepositoryMock {
  103. if mmAdd.mock.funcAdd != nil {
  104. mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Set")
  105. }
  106. if mmAdd.defaultExpectation == nil {
  107. mmAdd.defaultExpectation = &PlaceThingRepositoryMockAddExpectation{mock: mmAdd.mock}
  108. }
  109. mmAdd.defaultExpectation.results = &PlaceThingRepositoryMockAddResults{err}
  110. return mmAdd.mock
  111. }
  112. // Set uses given function f to mock the PlaceThingRepository.Add method
  113. func (mmAdd *mPlaceThingRepositoryMockAdd) Set(f func(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx) (err error)) *PlaceThingRepositoryMock {
  114. if mmAdd.defaultExpectation != nil {
  115. mmAdd.mock.t.Fatalf("Default expectation is already set for the PlaceThingRepository.Add method")
  116. }
  117. if len(mmAdd.expectations) > 0 {
  118. mmAdd.mock.t.Fatalf("Some expectations are already set for the PlaceThingRepository.Add method")
  119. }
  120. mmAdd.mock.funcAdd = f
  121. return mmAdd.mock
  122. }
  123. // When sets expectation for the PlaceThingRepository.Add which will trigger the result defined by the following
  124. // Then helper
  125. func (mmAdd *mPlaceThingRepositoryMockAdd) When(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx) *PlaceThingRepositoryMockAddExpectation {
  126. if mmAdd.mock.funcAdd != nil {
  127. mmAdd.mock.t.Fatalf("PlaceThingRepositoryMock.Add mock is already set by Set")
  128. }
  129. expectation := &PlaceThingRepositoryMockAddExpectation{
  130. mock: mmAdd.mock,
  131. params: &PlaceThingRepositoryMockAddParams{ctx, req, tx},
  132. }
  133. mmAdd.expectations = append(mmAdd.expectations, expectation)
  134. return expectation
  135. }
  136. // Then sets up PlaceThingRepository.Add return parameters for the expectation previously defined by the When method
  137. func (e *PlaceThingRepositoryMockAddExpectation) Then(err error) *PlaceThingRepositoryMock {
  138. e.results = &PlaceThingRepositoryMockAddResults{err}
  139. return e.mock
  140. }
  141. // Add implements interfaces.PlaceThingRepository
  142. func (mmAdd *PlaceThingRepositoryMock) Add(ctx context.Context, req models.AddPlaceThingRequest, tx *sql.Tx) (err error) {
  143. mm_atomic.AddUint64(&mmAdd.beforeAddCounter, 1)
  144. defer mm_atomic.AddUint64(&mmAdd.afterAddCounter, 1)
  145. if mmAdd.inspectFuncAdd != nil {
  146. mmAdd.inspectFuncAdd(ctx, req, tx)
  147. }
  148. mm_params := &PlaceThingRepositoryMockAddParams{ctx, req, tx}
  149. // Record call args
  150. mmAdd.AddMock.mutex.Lock()
  151. mmAdd.AddMock.callArgs = append(mmAdd.AddMock.callArgs, mm_params)
  152. mmAdd.AddMock.mutex.Unlock()
  153. for _, e := range mmAdd.AddMock.expectations {
  154. if minimock.Equal(e.params, mm_params) {
  155. mm_atomic.AddUint64(&e.Counter, 1)
  156. return e.results.err
  157. }
  158. }
  159. if mmAdd.AddMock.defaultExpectation != nil {
  160. mm_atomic.AddUint64(&mmAdd.AddMock.defaultExpectation.Counter, 1)
  161. mm_want := mmAdd.AddMock.defaultExpectation.params
  162. mm_got := PlaceThingRepositoryMockAddParams{ctx, req, tx}
  163. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  164. mmAdd.t.Errorf("PlaceThingRepositoryMock.Add got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  165. }
  166. mm_results := mmAdd.AddMock.defaultExpectation.results
  167. if mm_results == nil {
  168. mmAdd.t.Fatal("No results are set for the PlaceThingRepositoryMock.Add")
  169. }
  170. return (*mm_results).err
  171. }
  172. if mmAdd.funcAdd != nil {
  173. return mmAdd.funcAdd(ctx, req, tx)
  174. }
  175. mmAdd.t.Fatalf("Unexpected call to PlaceThingRepositoryMock.Add. %v %v %v", ctx, req, tx)
  176. return
  177. }
  178. // AddAfterCounter returns a count of finished PlaceThingRepositoryMock.Add invocations
  179. func (mmAdd *PlaceThingRepositoryMock) AddAfterCounter() uint64 {
  180. return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
  181. }
  182. // AddBeforeCounter returns a count of PlaceThingRepositoryMock.Add invocations
  183. func (mmAdd *PlaceThingRepositoryMock) AddBeforeCounter() uint64 {
  184. return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
  185. }
  186. // Calls returns a list of arguments used in each call to PlaceThingRepositoryMock.Add.
  187. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  188. func (mmAdd *mPlaceThingRepositoryMockAdd) Calls() []*PlaceThingRepositoryMockAddParams {
  189. mmAdd.mutex.RLock()
  190. argCopy := make([]*PlaceThingRepositoryMockAddParams, len(mmAdd.callArgs))
  191. copy(argCopy, mmAdd.callArgs)
  192. mmAdd.mutex.RUnlock()
  193. return argCopy
  194. }
  195. // MinimockAddDone returns true if the count of the Add invocations corresponds
  196. // the number of defined expectations
  197. func (m *PlaceThingRepositoryMock) MinimockAddDone() bool {
  198. for _, e := range m.AddMock.expectations {
  199. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  200. return false
  201. }
  202. }
  203. // if default expectation was set then invocations count should be greater than zero
  204. if m.AddMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
  205. return false
  206. }
  207. // if func was set then invocations count should be greater than zero
  208. if m.funcAdd != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
  209. return false
  210. }
  211. return true
  212. }
  213. // MinimockAddInspect logs each unmet expectation
  214. func (m *PlaceThingRepositoryMock) MinimockAddInspect() {
  215. for _, e := range m.AddMock.expectations {
  216. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  217. m.t.Errorf("Expected call to PlaceThingRepositoryMock.Add with params: %#v", *e.params)
  218. }
  219. }
  220. // if default expectation was set then invocations count should be greater than zero
  221. if m.AddMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
  222. if m.AddMock.defaultExpectation.params == nil {
  223. m.t.Error("Expected call to PlaceThingRepositoryMock.Add")
  224. } else {
  225. m.t.Errorf("Expected call to PlaceThingRepositoryMock.Add with params: %#v", *m.AddMock.defaultExpectation.params)
  226. }
  227. }
  228. // if func was set then invocations count should be greater than zero
  229. if m.funcAdd != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
  230. m.t.Error("Expected call to PlaceThingRepositoryMock.Add")
  231. }
  232. }
  233. type mPlaceThingRepositoryMockDeleteThing struct {
  234. mock *PlaceThingRepositoryMock
  235. defaultExpectation *PlaceThingRepositoryMockDeleteThingExpectation
  236. expectations []*PlaceThingRepositoryMockDeleteThingExpectation
  237. callArgs []*PlaceThingRepositoryMockDeleteThingParams
  238. mutex sync.RWMutex
  239. }
  240. // PlaceThingRepositoryMockDeleteThingExpectation specifies expectation struct of the PlaceThingRepository.DeleteThing
  241. type PlaceThingRepositoryMockDeleteThingExpectation struct {
  242. mock *PlaceThingRepositoryMock
  243. params *PlaceThingRepositoryMockDeleteThingParams
  244. results *PlaceThingRepositoryMockDeleteThingResults
  245. Counter uint64
  246. }
  247. // PlaceThingRepositoryMockDeleteThingParams contains parameters of the PlaceThingRepository.DeleteThing
  248. type PlaceThingRepositoryMockDeleteThingParams struct {
  249. ctx context.Context
  250. thingID int
  251. tx *sql.Tx
  252. }
  253. // PlaceThingRepositoryMockDeleteThingResults contains results of the PlaceThingRepository.DeleteThing
  254. type PlaceThingRepositoryMockDeleteThingResults struct {
  255. err error
  256. }
  257. // Expect sets up expected params for PlaceThingRepository.DeleteThing
  258. func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Expect(ctx context.Context, thingID int, tx *sql.Tx) *mPlaceThingRepositoryMockDeleteThing {
  259. if mmDeleteThing.mock.funcDeleteThing != nil {
  260. mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Set")
  261. }
  262. if mmDeleteThing.defaultExpectation == nil {
  263. mmDeleteThing.defaultExpectation = &PlaceThingRepositoryMockDeleteThingExpectation{}
  264. }
  265. mmDeleteThing.defaultExpectation.params = &PlaceThingRepositoryMockDeleteThingParams{ctx, thingID, tx}
  266. for _, e := range mmDeleteThing.expectations {
  267. if minimock.Equal(e.params, mmDeleteThing.defaultExpectation.params) {
  268. mmDeleteThing.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDeleteThing.defaultExpectation.params)
  269. }
  270. }
  271. return mmDeleteThing
  272. }
  273. // Inspect accepts an inspector function that has same arguments as the PlaceThingRepository.DeleteThing
  274. func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Inspect(f func(ctx context.Context, thingID int, tx *sql.Tx)) *mPlaceThingRepositoryMockDeleteThing {
  275. if mmDeleteThing.mock.inspectFuncDeleteThing != nil {
  276. mmDeleteThing.mock.t.Fatalf("Inspect function is already set for PlaceThingRepositoryMock.DeleteThing")
  277. }
  278. mmDeleteThing.mock.inspectFuncDeleteThing = f
  279. return mmDeleteThing
  280. }
  281. // Return sets up results that will be returned by PlaceThingRepository.DeleteThing
  282. func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Return(err error) *PlaceThingRepositoryMock {
  283. if mmDeleteThing.mock.funcDeleteThing != nil {
  284. mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Set")
  285. }
  286. if mmDeleteThing.defaultExpectation == nil {
  287. mmDeleteThing.defaultExpectation = &PlaceThingRepositoryMockDeleteThingExpectation{mock: mmDeleteThing.mock}
  288. }
  289. mmDeleteThing.defaultExpectation.results = &PlaceThingRepositoryMockDeleteThingResults{err}
  290. return mmDeleteThing.mock
  291. }
  292. // Set uses given function f to mock the PlaceThingRepository.DeleteThing method
  293. func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Set(f func(ctx context.Context, thingID int, tx *sql.Tx) (err error)) *PlaceThingRepositoryMock {
  294. if mmDeleteThing.defaultExpectation != nil {
  295. mmDeleteThing.mock.t.Fatalf("Default expectation is already set for the PlaceThingRepository.DeleteThing method")
  296. }
  297. if len(mmDeleteThing.expectations) > 0 {
  298. mmDeleteThing.mock.t.Fatalf("Some expectations are already set for the PlaceThingRepository.DeleteThing method")
  299. }
  300. mmDeleteThing.mock.funcDeleteThing = f
  301. return mmDeleteThing.mock
  302. }
  303. // When sets expectation for the PlaceThingRepository.DeleteThing which will trigger the result defined by the following
  304. // Then helper
  305. func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) When(ctx context.Context, thingID int, tx *sql.Tx) *PlaceThingRepositoryMockDeleteThingExpectation {
  306. if mmDeleteThing.mock.funcDeleteThing != nil {
  307. mmDeleteThing.mock.t.Fatalf("PlaceThingRepositoryMock.DeleteThing mock is already set by Set")
  308. }
  309. expectation := &PlaceThingRepositoryMockDeleteThingExpectation{
  310. mock: mmDeleteThing.mock,
  311. params: &PlaceThingRepositoryMockDeleteThingParams{ctx, thingID, tx},
  312. }
  313. mmDeleteThing.expectations = append(mmDeleteThing.expectations, expectation)
  314. return expectation
  315. }
  316. // Then sets up PlaceThingRepository.DeleteThing return parameters for the expectation previously defined by the When method
  317. func (e *PlaceThingRepositoryMockDeleteThingExpectation) Then(err error) *PlaceThingRepositoryMock {
  318. e.results = &PlaceThingRepositoryMockDeleteThingResults{err}
  319. return e.mock
  320. }
  321. // DeleteThing implements interfaces.PlaceThingRepository
  322. func (mmDeleteThing *PlaceThingRepositoryMock) DeleteThing(ctx context.Context, thingID int, tx *sql.Tx) (err error) {
  323. mm_atomic.AddUint64(&mmDeleteThing.beforeDeleteThingCounter, 1)
  324. defer mm_atomic.AddUint64(&mmDeleteThing.afterDeleteThingCounter, 1)
  325. if mmDeleteThing.inspectFuncDeleteThing != nil {
  326. mmDeleteThing.inspectFuncDeleteThing(ctx, thingID, tx)
  327. }
  328. mm_params := &PlaceThingRepositoryMockDeleteThingParams{ctx, thingID, tx}
  329. // Record call args
  330. mmDeleteThing.DeleteThingMock.mutex.Lock()
  331. mmDeleteThing.DeleteThingMock.callArgs = append(mmDeleteThing.DeleteThingMock.callArgs, mm_params)
  332. mmDeleteThing.DeleteThingMock.mutex.Unlock()
  333. for _, e := range mmDeleteThing.DeleteThingMock.expectations {
  334. if minimock.Equal(e.params, mm_params) {
  335. mm_atomic.AddUint64(&e.Counter, 1)
  336. return e.results.err
  337. }
  338. }
  339. if mmDeleteThing.DeleteThingMock.defaultExpectation != nil {
  340. mm_atomic.AddUint64(&mmDeleteThing.DeleteThingMock.defaultExpectation.Counter, 1)
  341. mm_want := mmDeleteThing.DeleteThingMock.defaultExpectation.params
  342. mm_got := PlaceThingRepositoryMockDeleteThingParams{ctx, thingID, tx}
  343. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  344. mmDeleteThing.t.Errorf("PlaceThingRepositoryMock.DeleteThing got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  345. }
  346. mm_results := mmDeleteThing.DeleteThingMock.defaultExpectation.results
  347. if mm_results == nil {
  348. mmDeleteThing.t.Fatal("No results are set for the PlaceThingRepositoryMock.DeleteThing")
  349. }
  350. return (*mm_results).err
  351. }
  352. if mmDeleteThing.funcDeleteThing != nil {
  353. return mmDeleteThing.funcDeleteThing(ctx, thingID, tx)
  354. }
  355. mmDeleteThing.t.Fatalf("Unexpected call to PlaceThingRepositoryMock.DeleteThing. %v %v %v", ctx, thingID, tx)
  356. return
  357. }
  358. // DeleteThingAfterCounter returns a count of finished PlaceThingRepositoryMock.DeleteThing invocations
  359. func (mmDeleteThing *PlaceThingRepositoryMock) DeleteThingAfterCounter() uint64 {
  360. return mm_atomic.LoadUint64(&mmDeleteThing.afterDeleteThingCounter)
  361. }
  362. // DeleteThingBeforeCounter returns a count of PlaceThingRepositoryMock.DeleteThing invocations
  363. func (mmDeleteThing *PlaceThingRepositoryMock) DeleteThingBeforeCounter() uint64 {
  364. return mm_atomic.LoadUint64(&mmDeleteThing.beforeDeleteThingCounter)
  365. }
  366. // Calls returns a list of arguments used in each call to PlaceThingRepositoryMock.DeleteThing.
  367. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  368. func (mmDeleteThing *mPlaceThingRepositoryMockDeleteThing) Calls() []*PlaceThingRepositoryMockDeleteThingParams {
  369. mmDeleteThing.mutex.RLock()
  370. argCopy := make([]*PlaceThingRepositoryMockDeleteThingParams, len(mmDeleteThing.callArgs))
  371. copy(argCopy, mmDeleteThing.callArgs)
  372. mmDeleteThing.mutex.RUnlock()
  373. return argCopy
  374. }
  375. // MinimockDeleteThingDone returns true if the count of the DeleteThing invocations corresponds
  376. // the number of defined expectations
  377. func (m *PlaceThingRepositoryMock) MinimockDeleteThingDone() bool {
  378. for _, e := range m.DeleteThingMock.expectations {
  379. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  380. return false
  381. }
  382. }
  383. // if default expectation was set then invocations count should be greater than zero
  384. if m.DeleteThingMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteThingCounter) < 1 {
  385. return false
  386. }
  387. // if func was set then invocations count should be greater than zero
  388. if m.funcDeleteThing != nil && mm_atomic.LoadUint64(&m.afterDeleteThingCounter) < 1 {
  389. return false
  390. }
  391. return true
  392. }
  393. // MinimockDeleteThingInspect logs each unmet expectation
  394. func (m *PlaceThingRepositoryMock) MinimockDeleteThingInspect() {
  395. for _, e := range m.DeleteThingMock.expectations {
  396. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  397. m.t.Errorf("Expected call to PlaceThingRepositoryMock.DeleteThing with params: %#v", *e.params)
  398. }
  399. }
  400. // if default expectation was set then invocations count should be greater than zero
  401. if m.DeleteThingMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteThingCounter) < 1 {
  402. if m.DeleteThingMock.defaultExpectation.params == nil {
  403. m.t.Error("Expected call to PlaceThingRepositoryMock.DeleteThing")
  404. } else {
  405. m.t.Errorf("Expected call to PlaceThingRepositoryMock.DeleteThing with params: %#v", *m.DeleteThingMock.defaultExpectation.params)
  406. }
  407. }
  408. // if func was set then invocations count should be greater than zero
  409. if m.funcDeleteThing != nil && mm_atomic.LoadUint64(&m.afterDeleteThingCounter) < 1 {
  410. m.t.Error("Expected call to PlaceThingRepositoryMock.DeleteThing")
  411. }
  412. }
  413. type mPlaceThingRepositoryMockGetByThingID struct {
  414. mock *PlaceThingRepositoryMock
  415. defaultExpectation *PlaceThingRepositoryMockGetByThingIDExpectation
  416. expectations []*PlaceThingRepositoryMockGetByThingIDExpectation
  417. callArgs []*PlaceThingRepositoryMockGetByThingIDParams
  418. mutex sync.RWMutex
  419. }
  420. // PlaceThingRepositoryMockGetByThingIDExpectation specifies expectation struct of the PlaceThingRepository.GetByThingID
  421. type PlaceThingRepositoryMockGetByThingIDExpectation struct {
  422. mock *PlaceThingRepositoryMock
  423. params *PlaceThingRepositoryMockGetByThingIDParams
  424. results *PlaceThingRepositoryMockGetByThingIDResults
  425. Counter uint64
  426. }
  427. // PlaceThingRepositoryMockGetByThingIDParams contains parameters of the PlaceThingRepository.GetByThingID
  428. type PlaceThingRepositoryMockGetByThingIDParams struct {
  429. ctx context.Context
  430. thingID int
  431. }
  432. // PlaceThingRepositoryMockGetByThingIDResults contains results of the PlaceThingRepository.GetByThingID
  433. type PlaceThingRepositoryMockGetByThingIDResults struct {
  434. pp1 *models.PlaceThing
  435. err error
  436. }
  437. // Expect sets up expected params for PlaceThingRepository.GetByThingID
  438. func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Expect(ctx context.Context, thingID int) *mPlaceThingRepositoryMockGetByThingID {
  439. if mmGetByThingID.mock.funcGetByThingID != nil {
  440. mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by Set")
  441. }
  442. if mmGetByThingID.defaultExpectation == nil {
  443. mmGetByThingID.defaultExpectation = &PlaceThingRepositoryMockGetByThingIDExpectation{}
  444. }
  445. mmGetByThingID.defaultExpectation.params = &PlaceThingRepositoryMockGetByThingIDParams{ctx, thingID}
  446. for _, e := range mmGetByThingID.expectations {
  447. if minimock.Equal(e.params, mmGetByThingID.defaultExpectation.params) {
  448. mmGetByThingID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByThingID.defaultExpectation.params)
  449. }
  450. }
  451. return mmGetByThingID
  452. }
  453. // Inspect accepts an inspector function that has same arguments as the PlaceThingRepository.GetByThingID
  454. func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Inspect(f func(ctx context.Context, thingID int)) *mPlaceThingRepositoryMockGetByThingID {
  455. if mmGetByThingID.mock.inspectFuncGetByThingID != nil {
  456. mmGetByThingID.mock.t.Fatalf("Inspect function is already set for PlaceThingRepositoryMock.GetByThingID")
  457. }
  458. mmGetByThingID.mock.inspectFuncGetByThingID = f
  459. return mmGetByThingID
  460. }
  461. // Return sets up results that will be returned by PlaceThingRepository.GetByThingID
  462. func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Return(pp1 *models.PlaceThing, err error) *PlaceThingRepositoryMock {
  463. if mmGetByThingID.mock.funcGetByThingID != nil {
  464. mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by Set")
  465. }
  466. if mmGetByThingID.defaultExpectation == nil {
  467. mmGetByThingID.defaultExpectation = &PlaceThingRepositoryMockGetByThingIDExpectation{mock: mmGetByThingID.mock}
  468. }
  469. mmGetByThingID.defaultExpectation.results = &PlaceThingRepositoryMockGetByThingIDResults{pp1, err}
  470. return mmGetByThingID.mock
  471. }
  472. // Set uses given function f to mock the PlaceThingRepository.GetByThingID method
  473. func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Set(f func(ctx context.Context, thingID int) (pp1 *models.PlaceThing, err error)) *PlaceThingRepositoryMock {
  474. if mmGetByThingID.defaultExpectation != nil {
  475. mmGetByThingID.mock.t.Fatalf("Default expectation is already set for the PlaceThingRepository.GetByThingID method")
  476. }
  477. if len(mmGetByThingID.expectations) > 0 {
  478. mmGetByThingID.mock.t.Fatalf("Some expectations are already set for the PlaceThingRepository.GetByThingID method")
  479. }
  480. mmGetByThingID.mock.funcGetByThingID = f
  481. return mmGetByThingID.mock
  482. }
  483. // When sets expectation for the PlaceThingRepository.GetByThingID which will trigger the result defined by the following
  484. // Then helper
  485. func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) When(ctx context.Context, thingID int) *PlaceThingRepositoryMockGetByThingIDExpectation {
  486. if mmGetByThingID.mock.funcGetByThingID != nil {
  487. mmGetByThingID.mock.t.Fatalf("PlaceThingRepositoryMock.GetByThingID mock is already set by Set")
  488. }
  489. expectation := &PlaceThingRepositoryMockGetByThingIDExpectation{
  490. mock: mmGetByThingID.mock,
  491. params: &PlaceThingRepositoryMockGetByThingIDParams{ctx, thingID},
  492. }
  493. mmGetByThingID.expectations = append(mmGetByThingID.expectations, expectation)
  494. return expectation
  495. }
  496. // Then sets up PlaceThingRepository.GetByThingID return parameters for the expectation previously defined by the When method
  497. func (e *PlaceThingRepositoryMockGetByThingIDExpectation) Then(pp1 *models.PlaceThing, err error) *PlaceThingRepositoryMock {
  498. e.results = &PlaceThingRepositoryMockGetByThingIDResults{pp1, err}
  499. return e.mock
  500. }
  501. // GetByThingID implements interfaces.PlaceThingRepository
  502. func (mmGetByThingID *PlaceThingRepositoryMock) GetByThingID(ctx context.Context, thingID int) (pp1 *models.PlaceThing, err error) {
  503. mm_atomic.AddUint64(&mmGetByThingID.beforeGetByThingIDCounter, 1)
  504. defer mm_atomic.AddUint64(&mmGetByThingID.afterGetByThingIDCounter, 1)
  505. if mmGetByThingID.inspectFuncGetByThingID != nil {
  506. mmGetByThingID.inspectFuncGetByThingID(ctx, thingID)
  507. }
  508. mm_params := &PlaceThingRepositoryMockGetByThingIDParams{ctx, thingID}
  509. // Record call args
  510. mmGetByThingID.GetByThingIDMock.mutex.Lock()
  511. mmGetByThingID.GetByThingIDMock.callArgs = append(mmGetByThingID.GetByThingIDMock.callArgs, mm_params)
  512. mmGetByThingID.GetByThingIDMock.mutex.Unlock()
  513. for _, e := range mmGetByThingID.GetByThingIDMock.expectations {
  514. if minimock.Equal(e.params, mm_params) {
  515. mm_atomic.AddUint64(&e.Counter, 1)
  516. return e.results.pp1, e.results.err
  517. }
  518. }
  519. if mmGetByThingID.GetByThingIDMock.defaultExpectation != nil {
  520. mm_atomic.AddUint64(&mmGetByThingID.GetByThingIDMock.defaultExpectation.Counter, 1)
  521. mm_want := mmGetByThingID.GetByThingIDMock.defaultExpectation.params
  522. mm_got := PlaceThingRepositoryMockGetByThingIDParams{ctx, thingID}
  523. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  524. mmGetByThingID.t.Errorf("PlaceThingRepositoryMock.GetByThingID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  525. }
  526. mm_results := mmGetByThingID.GetByThingIDMock.defaultExpectation.results
  527. if mm_results == nil {
  528. mmGetByThingID.t.Fatal("No results are set for the PlaceThingRepositoryMock.GetByThingID")
  529. }
  530. return (*mm_results).pp1, (*mm_results).err
  531. }
  532. if mmGetByThingID.funcGetByThingID != nil {
  533. return mmGetByThingID.funcGetByThingID(ctx, thingID)
  534. }
  535. mmGetByThingID.t.Fatalf("Unexpected call to PlaceThingRepositoryMock.GetByThingID. %v %v", ctx, thingID)
  536. return
  537. }
  538. // GetByThingIDAfterCounter returns a count of finished PlaceThingRepositoryMock.GetByThingID invocations
  539. func (mmGetByThingID *PlaceThingRepositoryMock) GetByThingIDAfterCounter() uint64 {
  540. return mm_atomic.LoadUint64(&mmGetByThingID.afterGetByThingIDCounter)
  541. }
  542. // GetByThingIDBeforeCounter returns a count of PlaceThingRepositoryMock.GetByThingID invocations
  543. func (mmGetByThingID *PlaceThingRepositoryMock) GetByThingIDBeforeCounter() uint64 {
  544. return mm_atomic.LoadUint64(&mmGetByThingID.beforeGetByThingIDCounter)
  545. }
  546. // Calls returns a list of arguments used in each call to PlaceThingRepositoryMock.GetByThingID.
  547. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  548. func (mmGetByThingID *mPlaceThingRepositoryMockGetByThingID) Calls() []*PlaceThingRepositoryMockGetByThingIDParams {
  549. mmGetByThingID.mutex.RLock()
  550. argCopy := make([]*PlaceThingRepositoryMockGetByThingIDParams, len(mmGetByThingID.callArgs))
  551. copy(argCopy, mmGetByThingID.callArgs)
  552. mmGetByThingID.mutex.RUnlock()
  553. return argCopy
  554. }
  555. // MinimockGetByThingIDDone returns true if the count of the GetByThingID invocations corresponds
  556. // the number of defined expectations
  557. func (m *PlaceThingRepositoryMock) MinimockGetByThingIDDone() bool {
  558. for _, e := range m.GetByThingIDMock.expectations {
  559. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  560. return false
  561. }
  562. }
  563. // if default expectation was set then invocations count should be greater than zero
  564. if m.GetByThingIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByThingIDCounter) < 1 {
  565. return false
  566. }
  567. // if func was set then invocations count should be greater than zero
  568. if m.funcGetByThingID != nil && mm_atomic.LoadUint64(&m.afterGetByThingIDCounter) < 1 {
  569. return false
  570. }
  571. return true
  572. }
  573. // MinimockGetByThingIDInspect logs each unmet expectation
  574. func (m *PlaceThingRepositoryMock) MinimockGetByThingIDInspect() {
  575. for _, e := range m.GetByThingIDMock.expectations {
  576. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  577. m.t.Errorf("Expected call to PlaceThingRepositoryMock.GetByThingID with params: %#v", *e.params)
  578. }
  579. }
  580. // if default expectation was set then invocations count should be greater than zero
  581. if m.GetByThingIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByThingIDCounter) < 1 {
  582. if m.GetByThingIDMock.defaultExpectation.params == nil {
  583. m.t.Error("Expected call to PlaceThingRepositoryMock.GetByThingID")
  584. } else {
  585. m.t.Errorf("Expected call to PlaceThingRepositoryMock.GetByThingID with params: %#v", *m.GetByThingIDMock.defaultExpectation.params)
  586. }
  587. }
  588. // if func was set then invocations count should be greater than zero
  589. if m.funcGetByThingID != nil && mm_atomic.LoadUint64(&m.afterGetByThingIDCounter) < 1 {
  590. m.t.Error("Expected call to PlaceThingRepositoryMock.GetByThingID")
  591. }
  592. }
  593. type mPlaceThingRepositoryMockUpdatePlace struct {
  594. mock *PlaceThingRepositoryMock
  595. defaultExpectation *PlaceThingRepositoryMockUpdatePlaceExpectation
  596. expectations []*PlaceThingRepositoryMockUpdatePlaceExpectation
  597. callArgs []*PlaceThingRepositoryMockUpdatePlaceParams
  598. mutex sync.RWMutex
  599. }
  600. // PlaceThingRepositoryMockUpdatePlaceExpectation specifies expectation struct of the PlaceThingRepository.UpdatePlace
  601. type PlaceThingRepositoryMockUpdatePlaceExpectation struct {
  602. mock *PlaceThingRepositoryMock
  603. params *PlaceThingRepositoryMockUpdatePlaceParams
  604. results *PlaceThingRepositoryMockUpdatePlaceResults
  605. Counter uint64
  606. }
  607. // PlaceThingRepositoryMockUpdatePlaceParams contains parameters of the PlaceThingRepository.UpdatePlace
  608. type PlaceThingRepositoryMockUpdatePlaceParams struct {
  609. ctx context.Context
  610. req models.UpdatePlaceThingRequest
  611. tx *sql.Tx
  612. }
  613. // PlaceThingRepositoryMockUpdatePlaceResults contains results of the PlaceThingRepository.UpdatePlace
  614. type PlaceThingRepositoryMockUpdatePlaceResults struct {
  615. err error
  616. }
  617. // Expect sets up expected params for PlaceThingRepository.UpdatePlace
  618. func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Expect(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx) *mPlaceThingRepositoryMockUpdatePlace {
  619. if mmUpdatePlace.mock.funcUpdatePlace != nil {
  620. mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Set")
  621. }
  622. if mmUpdatePlace.defaultExpectation == nil {
  623. mmUpdatePlace.defaultExpectation = &PlaceThingRepositoryMockUpdatePlaceExpectation{}
  624. }
  625. mmUpdatePlace.defaultExpectation.params = &PlaceThingRepositoryMockUpdatePlaceParams{ctx, req, tx}
  626. for _, e := range mmUpdatePlace.expectations {
  627. if minimock.Equal(e.params, mmUpdatePlace.defaultExpectation.params) {
  628. mmUpdatePlace.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdatePlace.defaultExpectation.params)
  629. }
  630. }
  631. return mmUpdatePlace
  632. }
  633. // Inspect accepts an inspector function that has same arguments as the PlaceThingRepository.UpdatePlace
  634. func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Inspect(f func(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx)) *mPlaceThingRepositoryMockUpdatePlace {
  635. if mmUpdatePlace.mock.inspectFuncUpdatePlace != nil {
  636. mmUpdatePlace.mock.t.Fatalf("Inspect function is already set for PlaceThingRepositoryMock.UpdatePlace")
  637. }
  638. mmUpdatePlace.mock.inspectFuncUpdatePlace = f
  639. return mmUpdatePlace
  640. }
  641. // Return sets up results that will be returned by PlaceThingRepository.UpdatePlace
  642. func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Return(err error) *PlaceThingRepositoryMock {
  643. if mmUpdatePlace.mock.funcUpdatePlace != nil {
  644. mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Set")
  645. }
  646. if mmUpdatePlace.defaultExpectation == nil {
  647. mmUpdatePlace.defaultExpectation = &PlaceThingRepositoryMockUpdatePlaceExpectation{mock: mmUpdatePlace.mock}
  648. }
  649. mmUpdatePlace.defaultExpectation.results = &PlaceThingRepositoryMockUpdatePlaceResults{err}
  650. return mmUpdatePlace.mock
  651. }
  652. // Set uses given function f to mock the PlaceThingRepository.UpdatePlace method
  653. func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Set(f func(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx) (err error)) *PlaceThingRepositoryMock {
  654. if mmUpdatePlace.defaultExpectation != nil {
  655. mmUpdatePlace.mock.t.Fatalf("Default expectation is already set for the PlaceThingRepository.UpdatePlace method")
  656. }
  657. if len(mmUpdatePlace.expectations) > 0 {
  658. mmUpdatePlace.mock.t.Fatalf("Some expectations are already set for the PlaceThingRepository.UpdatePlace method")
  659. }
  660. mmUpdatePlace.mock.funcUpdatePlace = f
  661. return mmUpdatePlace.mock
  662. }
  663. // When sets expectation for the PlaceThingRepository.UpdatePlace which will trigger the result defined by the following
  664. // Then helper
  665. func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) When(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx) *PlaceThingRepositoryMockUpdatePlaceExpectation {
  666. if mmUpdatePlace.mock.funcUpdatePlace != nil {
  667. mmUpdatePlace.mock.t.Fatalf("PlaceThingRepositoryMock.UpdatePlace mock is already set by Set")
  668. }
  669. expectation := &PlaceThingRepositoryMockUpdatePlaceExpectation{
  670. mock: mmUpdatePlace.mock,
  671. params: &PlaceThingRepositoryMockUpdatePlaceParams{ctx, req, tx},
  672. }
  673. mmUpdatePlace.expectations = append(mmUpdatePlace.expectations, expectation)
  674. return expectation
  675. }
  676. // Then sets up PlaceThingRepository.UpdatePlace return parameters for the expectation previously defined by the When method
  677. func (e *PlaceThingRepositoryMockUpdatePlaceExpectation) Then(err error) *PlaceThingRepositoryMock {
  678. e.results = &PlaceThingRepositoryMockUpdatePlaceResults{err}
  679. return e.mock
  680. }
  681. // UpdatePlace implements interfaces.PlaceThingRepository
  682. func (mmUpdatePlace *PlaceThingRepositoryMock) UpdatePlace(ctx context.Context, req models.UpdatePlaceThingRequest, tx *sql.Tx) (err error) {
  683. mm_atomic.AddUint64(&mmUpdatePlace.beforeUpdatePlaceCounter, 1)
  684. defer mm_atomic.AddUint64(&mmUpdatePlace.afterUpdatePlaceCounter, 1)
  685. if mmUpdatePlace.inspectFuncUpdatePlace != nil {
  686. mmUpdatePlace.inspectFuncUpdatePlace(ctx, req, tx)
  687. }
  688. mm_params := &PlaceThingRepositoryMockUpdatePlaceParams{ctx, req, tx}
  689. // Record call args
  690. mmUpdatePlace.UpdatePlaceMock.mutex.Lock()
  691. mmUpdatePlace.UpdatePlaceMock.callArgs = append(mmUpdatePlace.UpdatePlaceMock.callArgs, mm_params)
  692. mmUpdatePlace.UpdatePlaceMock.mutex.Unlock()
  693. for _, e := range mmUpdatePlace.UpdatePlaceMock.expectations {
  694. if minimock.Equal(e.params, mm_params) {
  695. mm_atomic.AddUint64(&e.Counter, 1)
  696. return e.results.err
  697. }
  698. }
  699. if mmUpdatePlace.UpdatePlaceMock.defaultExpectation != nil {
  700. mm_atomic.AddUint64(&mmUpdatePlace.UpdatePlaceMock.defaultExpectation.Counter, 1)
  701. mm_want := mmUpdatePlace.UpdatePlaceMock.defaultExpectation.params
  702. mm_got := PlaceThingRepositoryMockUpdatePlaceParams{ctx, req, tx}
  703. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  704. mmUpdatePlace.t.Errorf("PlaceThingRepositoryMock.UpdatePlace got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  705. }
  706. mm_results := mmUpdatePlace.UpdatePlaceMock.defaultExpectation.results
  707. if mm_results == nil {
  708. mmUpdatePlace.t.Fatal("No results are set for the PlaceThingRepositoryMock.UpdatePlace")
  709. }
  710. return (*mm_results).err
  711. }
  712. if mmUpdatePlace.funcUpdatePlace != nil {
  713. return mmUpdatePlace.funcUpdatePlace(ctx, req, tx)
  714. }
  715. mmUpdatePlace.t.Fatalf("Unexpected call to PlaceThingRepositoryMock.UpdatePlace. %v %v %v", ctx, req, tx)
  716. return
  717. }
  718. // UpdatePlaceAfterCounter returns a count of finished PlaceThingRepositoryMock.UpdatePlace invocations
  719. func (mmUpdatePlace *PlaceThingRepositoryMock) UpdatePlaceAfterCounter() uint64 {
  720. return mm_atomic.LoadUint64(&mmUpdatePlace.afterUpdatePlaceCounter)
  721. }
  722. // UpdatePlaceBeforeCounter returns a count of PlaceThingRepositoryMock.UpdatePlace invocations
  723. func (mmUpdatePlace *PlaceThingRepositoryMock) UpdatePlaceBeforeCounter() uint64 {
  724. return mm_atomic.LoadUint64(&mmUpdatePlace.beforeUpdatePlaceCounter)
  725. }
  726. // Calls returns a list of arguments used in each call to PlaceThingRepositoryMock.UpdatePlace.
  727. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  728. func (mmUpdatePlace *mPlaceThingRepositoryMockUpdatePlace) Calls() []*PlaceThingRepositoryMockUpdatePlaceParams {
  729. mmUpdatePlace.mutex.RLock()
  730. argCopy := make([]*PlaceThingRepositoryMockUpdatePlaceParams, len(mmUpdatePlace.callArgs))
  731. copy(argCopy, mmUpdatePlace.callArgs)
  732. mmUpdatePlace.mutex.RUnlock()
  733. return argCopy
  734. }
  735. // MinimockUpdatePlaceDone returns true if the count of the UpdatePlace invocations corresponds
  736. // the number of defined expectations
  737. func (m *PlaceThingRepositoryMock) MinimockUpdatePlaceDone() bool {
  738. for _, e := range m.UpdatePlaceMock.expectations {
  739. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  740. return false
  741. }
  742. }
  743. // if default expectation was set then invocations count should be greater than zero
  744. if m.UpdatePlaceMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterUpdatePlaceCounter) < 1 {
  745. return false
  746. }
  747. // if func was set then invocations count should be greater than zero
  748. if m.funcUpdatePlace != nil && mm_atomic.LoadUint64(&m.afterUpdatePlaceCounter) < 1 {
  749. return false
  750. }
  751. return true
  752. }
  753. // MinimockUpdatePlaceInspect logs each unmet expectation
  754. func (m *PlaceThingRepositoryMock) MinimockUpdatePlaceInspect() {
  755. for _, e := range m.UpdatePlaceMock.expectations {
  756. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  757. m.t.Errorf("Expected call to PlaceThingRepositoryMock.UpdatePlace with params: %#v", *e.params)
  758. }
  759. }
  760. // if default expectation was set then invocations count should be greater than zero
  761. if m.UpdatePlaceMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterUpdatePlaceCounter) < 1 {
  762. if m.UpdatePlaceMock.defaultExpectation.params == nil {
  763. m.t.Error("Expected call to PlaceThingRepositoryMock.UpdatePlace")
  764. } else {
  765. m.t.Errorf("Expected call to PlaceThingRepositoryMock.UpdatePlace with params: %#v", *m.UpdatePlaceMock.defaultExpectation.params)
  766. }
  767. }
  768. // if func was set then invocations count should be greater than zero
  769. if m.funcUpdatePlace != nil && mm_atomic.LoadUint64(&m.afterUpdatePlaceCounter) < 1 {
  770. m.t.Error("Expected call to PlaceThingRepositoryMock.UpdatePlace")
  771. }
  772. }
  773. // MinimockFinish checks that all mocked methods have been called the expected number of times
  774. func (m *PlaceThingRepositoryMock) MinimockFinish() {
  775. if !m.minimockDone() {
  776. m.MinimockAddInspect()
  777. m.MinimockDeleteThingInspect()
  778. m.MinimockGetByThingIDInspect()
  779. m.MinimockUpdatePlaceInspect()
  780. m.t.FailNow()
  781. }
  782. }
  783. // MinimockWait waits for all mocked methods to be called the expected number of times
  784. func (m *PlaceThingRepositoryMock) MinimockWait(timeout mm_time.Duration) {
  785. timeoutCh := mm_time.After(timeout)
  786. for {
  787. if m.minimockDone() {
  788. return
  789. }
  790. select {
  791. case <-timeoutCh:
  792. m.MinimockFinish()
  793. return
  794. case <-mm_time.After(10 * mm_time.Millisecond):
  795. }
  796. }
  797. }
  798. func (m *PlaceThingRepositoryMock) minimockDone() bool {
  799. done := true
  800. return done &&
  801. m.MinimockAddDone() &&
  802. m.MinimockDeleteThingDone() &&
  803. m.MinimockGetByThingIDDone() &&
  804. m.MinimockUpdatePlaceDone()
  805. }