i_article_repository_minimock.go 73 KB

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