|
@@ -1,2113 +0,0 @@
|
|
|
-package mocks
|
|
|
-
|
|
|
-// Code generated by http://github.com/gojuno/minimock (dev). DO NOT EDIT.
|
|
|
-
|
|
|
-//go:generate minimock -i git.dmitriygnatenko.ru/dima/dmitriygnatenko-v2/internal/interfaces.TagRepository -o ./mocks/tag_repository_minimock.go -n TagRepositoryMock
|
|
|
-
|
|
|
-import (
|
|
|
- "context"
|
|
|
- "sync"
|
|
|
- mm_atomic "sync/atomic"
|
|
|
- mm_time "time"
|
|
|
-
|
|
|
- "git.dmitriygnatenko.ru/dima/dmitriygnatenko-v2/internal/models"
|
|
|
- "github.com/gojuno/minimock/v3"
|
|
|
-)
|
|
|
-
|
|
|
-// TagRepositoryMock implements interfaces.TagRepository
|
|
|
-type TagRepositoryMock struct {
|
|
|
- t minimock.Tester
|
|
|
-
|
|
|
- funcAdd func(ctx context.Context, m models.Tag) (err error)
|
|
|
- inspectFuncAdd func(ctx context.Context, m models.Tag)
|
|
|
- afterAddCounter uint64
|
|
|
- beforeAddCounter uint64
|
|
|
- AddMock mTagRepositoryMockAdd
|
|
|
-
|
|
|
- funcDelete func(ctx context.Context, ID int) (err error)
|
|
|
- inspectFuncDelete func(ctx context.Context, ID int)
|
|
|
- afterDeleteCounter uint64
|
|
|
- beforeDeleteCounter uint64
|
|
|
- DeleteMock mTagRepositoryMockDelete
|
|
|
-
|
|
|
- funcGetAll func(ctx context.Context) (ta1 []models.Tag, err error)
|
|
|
- inspectFuncGetAll func(ctx context.Context)
|
|
|
- afterGetAllCounter uint64
|
|
|
- beforeGetAllCounter uint64
|
|
|
- GetAllMock mTagRepositoryMockGetAll
|
|
|
-
|
|
|
- funcGetAllUsed func(ctx context.Context) (ta1 []models.Tag, err error)
|
|
|
- inspectFuncGetAllUsed func(ctx context.Context)
|
|
|
- afterGetAllUsedCounter uint64
|
|
|
- beforeGetAllUsedCounter uint64
|
|
|
- GetAllUsedMock mTagRepositoryMockGetAllUsed
|
|
|
-
|
|
|
- funcGetByArticleID func(ctx context.Context, ID int) (ta1 []models.Tag, err error)
|
|
|
- inspectFuncGetByArticleID func(ctx context.Context, ID int)
|
|
|
- afterGetByArticleIDCounter uint64
|
|
|
- beforeGetByArticleIDCounter uint64
|
|
|
- GetByArticleIDMock mTagRepositoryMockGetByArticleID
|
|
|
-
|
|
|
- funcGetByID func(ctx context.Context, ID int) (tp1 *models.Tag, err error)
|
|
|
- inspectFuncGetByID func(ctx context.Context, ID int)
|
|
|
- afterGetByIDCounter uint64
|
|
|
- beforeGetByIDCounter uint64
|
|
|
- GetByIDMock mTagRepositoryMockGetByID
|
|
|
-
|
|
|
- funcGetByURL func(ctx context.Context, tag string) (tp1 *models.Tag, err error)
|
|
|
- inspectFuncGetByURL func(ctx context.Context, tag string)
|
|
|
- afterGetByURLCounter uint64
|
|
|
- beforeGetByURLCounter uint64
|
|
|
- GetByURLMock mTagRepositoryMockGetByURL
|
|
|
-
|
|
|
- funcIsUsed func(ctx context.Context, ID int) (b1 bool, err error)
|
|
|
- inspectFuncIsUsed func(ctx context.Context, ID int)
|
|
|
- afterIsUsedCounter uint64
|
|
|
- beforeIsUsedCounter uint64
|
|
|
- IsUsedMock mTagRepositoryMockIsUsed
|
|
|
-
|
|
|
- funcUpdate func(ctx context.Context, m models.Tag) (err error)
|
|
|
- inspectFuncUpdate func(ctx context.Context, m models.Tag)
|
|
|
- afterUpdateCounter uint64
|
|
|
- beforeUpdateCounter uint64
|
|
|
- UpdateMock mTagRepositoryMockUpdate
|
|
|
-}
|
|
|
-
|
|
|
-// NewTagRepositoryMock returns a mock for interfaces.TagRepository
|
|
|
-func NewTagRepositoryMock(t minimock.Tester) *TagRepositoryMock {
|
|
|
- m := &TagRepositoryMock{t: t}
|
|
|
- if controller, ok := t.(minimock.MockController); ok {
|
|
|
- controller.RegisterMocker(m)
|
|
|
- }
|
|
|
-
|
|
|
- m.AddMock = mTagRepositoryMockAdd{mock: m}
|
|
|
- m.AddMock.callArgs = []*TagRepositoryMockAddParams{}
|
|
|
-
|
|
|
- m.DeleteMock = mTagRepositoryMockDelete{mock: m}
|
|
|
- m.DeleteMock.callArgs = []*TagRepositoryMockDeleteParams{}
|
|
|
-
|
|
|
- m.GetAllMock = mTagRepositoryMockGetAll{mock: m}
|
|
|
- m.GetAllMock.callArgs = []*TagRepositoryMockGetAllParams{}
|
|
|
-
|
|
|
- m.GetAllUsedMock = mTagRepositoryMockGetAllUsed{mock: m}
|
|
|
- m.GetAllUsedMock.callArgs = []*TagRepositoryMockGetAllUsedParams{}
|
|
|
-
|
|
|
- m.GetByArticleIDMock = mTagRepositoryMockGetByArticleID{mock: m}
|
|
|
- m.GetByArticleIDMock.callArgs = []*TagRepositoryMockGetByArticleIDParams{}
|
|
|
-
|
|
|
- m.GetByIDMock = mTagRepositoryMockGetByID{mock: m}
|
|
|
- m.GetByIDMock.callArgs = []*TagRepositoryMockGetByIDParams{}
|
|
|
-
|
|
|
- m.GetByURLMock = mTagRepositoryMockGetByURL{mock: m}
|
|
|
- m.GetByURLMock.callArgs = []*TagRepositoryMockGetByURLParams{}
|
|
|
-
|
|
|
- m.IsUsedMock = mTagRepositoryMockIsUsed{mock: m}
|
|
|
- m.IsUsedMock.callArgs = []*TagRepositoryMockIsUsedParams{}
|
|
|
-
|
|
|
- m.UpdateMock = mTagRepositoryMockUpdate{mock: m}
|
|
|
- m.UpdateMock.callArgs = []*TagRepositoryMockUpdateParams{}
|
|
|
-
|
|
|
- return m
|
|
|
-}
|
|
|
-
|
|
|
-type mTagRepositoryMockAdd struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- defaultExpectation *TagRepositoryMockAddExpectation
|
|
|
- expectations []*TagRepositoryMockAddExpectation
|
|
|
-
|
|
|
- callArgs []*TagRepositoryMockAddParams
|
|
|
- mutex sync.RWMutex
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockAddExpectation specifies expectation struct of the TagRepository.Add
|
|
|
-type TagRepositoryMockAddExpectation struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- params *TagRepositoryMockAddParams
|
|
|
- results *TagRepositoryMockAddResults
|
|
|
- Counter uint64
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockAddParams contains parameters of the TagRepository.Add
|
|
|
-type TagRepositoryMockAddParams struct {
|
|
|
- ctx context.Context
|
|
|
- m models.Tag
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockAddResults contains results of the TagRepository.Add
|
|
|
-type TagRepositoryMockAddResults struct {
|
|
|
- err error
|
|
|
-}
|
|
|
-
|
|
|
-// Expect sets up expected params for TagRepository.Add
|
|
|
-func (mmAdd *mTagRepositoryMockAdd) Expect(ctx context.Context, m models.Tag) *mTagRepositoryMockAdd {
|
|
|
- if mmAdd.mock.funcAdd != nil {
|
|
|
- mmAdd.mock.t.Fatalf("TagRepositoryMock.Add mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmAdd.defaultExpectation == nil {
|
|
|
- mmAdd.defaultExpectation = &TagRepositoryMockAddExpectation{}
|
|
|
- }
|
|
|
-
|
|
|
- mmAdd.defaultExpectation.params = &TagRepositoryMockAddParams{ctx, m}
|
|
|
- for _, e := range mmAdd.expectations {
|
|
|
- if minimock.Equal(e.params, mmAdd.defaultExpectation.params) {
|
|
|
- mmAdd.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmAdd.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return mmAdd
|
|
|
-}
|
|
|
-
|
|
|
-// Inspect accepts an inspector function that has same arguments as the TagRepository.Add
|
|
|
-func (mmAdd *mTagRepositoryMockAdd) Inspect(f func(ctx context.Context, m models.Tag)) *mTagRepositoryMockAdd {
|
|
|
- if mmAdd.mock.inspectFuncAdd != nil {
|
|
|
- mmAdd.mock.t.Fatalf("Inspect function is already set for TagRepositoryMock.Add")
|
|
|
- }
|
|
|
-
|
|
|
- mmAdd.mock.inspectFuncAdd = f
|
|
|
-
|
|
|
- return mmAdd
|
|
|
-}
|
|
|
-
|
|
|
-// Return sets up results that will be returned by TagRepository.Add
|
|
|
-func (mmAdd *mTagRepositoryMockAdd) Return(err error) *TagRepositoryMock {
|
|
|
- if mmAdd.mock.funcAdd != nil {
|
|
|
- mmAdd.mock.t.Fatalf("TagRepositoryMock.Add mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmAdd.defaultExpectation == nil {
|
|
|
- mmAdd.defaultExpectation = &TagRepositoryMockAddExpectation{mock: mmAdd.mock}
|
|
|
- }
|
|
|
- mmAdd.defaultExpectation.results = &TagRepositoryMockAddResults{err}
|
|
|
- return mmAdd.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Set uses given function f to mock the TagRepository.Add method
|
|
|
-func (mmAdd *mTagRepositoryMockAdd) Set(f func(ctx context.Context, m models.Tag) (err error)) *TagRepositoryMock {
|
|
|
- if mmAdd.defaultExpectation != nil {
|
|
|
- mmAdd.mock.t.Fatalf("Default expectation is already set for the TagRepository.Add method")
|
|
|
- }
|
|
|
-
|
|
|
- if len(mmAdd.expectations) > 0 {
|
|
|
- mmAdd.mock.t.Fatalf("Some expectations are already set for the TagRepository.Add method")
|
|
|
- }
|
|
|
-
|
|
|
- mmAdd.mock.funcAdd = f
|
|
|
- return mmAdd.mock
|
|
|
-}
|
|
|
-
|
|
|
-// When sets expectation for the TagRepository.Add which will trigger the result defined by the following
|
|
|
-// Then helper
|
|
|
-func (mmAdd *mTagRepositoryMockAdd) When(ctx context.Context, m models.Tag) *TagRepositoryMockAddExpectation {
|
|
|
- if mmAdd.mock.funcAdd != nil {
|
|
|
- mmAdd.mock.t.Fatalf("TagRepositoryMock.Add mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- expectation := &TagRepositoryMockAddExpectation{
|
|
|
- mock: mmAdd.mock,
|
|
|
- params: &TagRepositoryMockAddParams{ctx, m},
|
|
|
- }
|
|
|
- mmAdd.expectations = append(mmAdd.expectations, expectation)
|
|
|
- return expectation
|
|
|
-}
|
|
|
-
|
|
|
-// Then sets up TagRepository.Add return parameters for the expectation previously defined by the When method
|
|
|
-func (e *TagRepositoryMockAddExpectation) Then(err error) *TagRepositoryMock {
|
|
|
- e.results = &TagRepositoryMockAddResults{err}
|
|
|
- return e.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Add implements interfaces.TagRepository
|
|
|
-func (mmAdd *TagRepositoryMock) Add(ctx context.Context, m models.Tag) (err error) {
|
|
|
- mm_atomic.AddUint64(&mmAdd.beforeAddCounter, 1)
|
|
|
- defer mm_atomic.AddUint64(&mmAdd.afterAddCounter, 1)
|
|
|
-
|
|
|
- if mmAdd.inspectFuncAdd != nil {
|
|
|
- mmAdd.inspectFuncAdd(ctx, m)
|
|
|
- }
|
|
|
-
|
|
|
- mm_params := &TagRepositoryMockAddParams{ctx, m}
|
|
|
-
|
|
|
- // Record call args
|
|
|
- mmAdd.AddMock.mutex.Lock()
|
|
|
- mmAdd.AddMock.callArgs = append(mmAdd.AddMock.callArgs, mm_params)
|
|
|
- mmAdd.AddMock.mutex.Unlock()
|
|
|
-
|
|
|
- for _, e := range mmAdd.AddMock.expectations {
|
|
|
- if minimock.Equal(e.params, mm_params) {
|
|
|
- mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
- return e.results.err
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if mmAdd.AddMock.defaultExpectation != nil {
|
|
|
- mm_atomic.AddUint64(&mmAdd.AddMock.defaultExpectation.Counter, 1)
|
|
|
- mm_want := mmAdd.AddMock.defaultExpectation.params
|
|
|
- mm_got := TagRepositoryMockAddParams{ctx, m}
|
|
|
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
- mmAdd.t.Errorf("TagRepositoryMock.Add got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
- }
|
|
|
-
|
|
|
- mm_results := mmAdd.AddMock.defaultExpectation.results
|
|
|
- if mm_results == nil {
|
|
|
- mmAdd.t.Fatal("No results are set for the TagRepositoryMock.Add")
|
|
|
- }
|
|
|
- return (*mm_results).err
|
|
|
- }
|
|
|
- if mmAdd.funcAdd != nil {
|
|
|
- return mmAdd.funcAdd(ctx, m)
|
|
|
- }
|
|
|
- mmAdd.t.Fatalf("Unexpected call to TagRepositoryMock.Add. %v %v", ctx, m)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// AddAfterCounter returns a count of finished TagRepositoryMock.Add invocations
|
|
|
-func (mmAdd *TagRepositoryMock) AddAfterCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmAdd.afterAddCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// AddBeforeCounter returns a count of TagRepositoryMock.Add invocations
|
|
|
-func (mmAdd *TagRepositoryMock) AddBeforeCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmAdd.beforeAddCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// Calls returns a list of arguments used in each call to TagRepositoryMock.Add.
|
|
|
-// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
-func (mmAdd *mTagRepositoryMockAdd) Calls() []*TagRepositoryMockAddParams {
|
|
|
- mmAdd.mutex.RLock()
|
|
|
-
|
|
|
- argCopy := make([]*TagRepositoryMockAddParams, len(mmAdd.callArgs))
|
|
|
- copy(argCopy, mmAdd.callArgs)
|
|
|
-
|
|
|
- mmAdd.mutex.RUnlock()
|
|
|
-
|
|
|
- return argCopy
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockAddDone returns true if the count of the Add invocations corresponds
|
|
|
-// the number of defined expectations
|
|
|
-func (m *TagRepositoryMock) MinimockAddDone() bool {
|
|
|
- for _, e := range m.AddMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.AddMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcAdd != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockAddInspect logs each unmet expectation
|
|
|
-func (m *TagRepositoryMock) MinimockAddInspect() {
|
|
|
- for _, e := range m.AddMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.Add with params: %#v", *e.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.AddMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
|
|
|
- if m.AddMock.defaultExpectation.params == nil {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.Add")
|
|
|
- } else {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.Add with params: %#v", *m.AddMock.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcAdd != nil && mm_atomic.LoadUint64(&m.afterAddCounter) < 1 {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.Add")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-type mTagRepositoryMockDelete struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- defaultExpectation *TagRepositoryMockDeleteExpectation
|
|
|
- expectations []*TagRepositoryMockDeleteExpectation
|
|
|
-
|
|
|
- callArgs []*TagRepositoryMockDeleteParams
|
|
|
- mutex sync.RWMutex
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockDeleteExpectation specifies expectation struct of the TagRepository.Delete
|
|
|
-type TagRepositoryMockDeleteExpectation struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- params *TagRepositoryMockDeleteParams
|
|
|
- results *TagRepositoryMockDeleteResults
|
|
|
- Counter uint64
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockDeleteParams contains parameters of the TagRepository.Delete
|
|
|
-type TagRepositoryMockDeleteParams struct {
|
|
|
- ctx context.Context
|
|
|
- ID int
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockDeleteResults contains results of the TagRepository.Delete
|
|
|
-type TagRepositoryMockDeleteResults struct {
|
|
|
- err error
|
|
|
-}
|
|
|
-
|
|
|
-// Expect sets up expected params for TagRepository.Delete
|
|
|
-func (mmDelete *mTagRepositoryMockDelete) Expect(ctx context.Context, ID int) *mTagRepositoryMockDelete {
|
|
|
- if mmDelete.mock.funcDelete != nil {
|
|
|
- mmDelete.mock.t.Fatalf("TagRepositoryMock.Delete mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmDelete.defaultExpectation == nil {
|
|
|
- mmDelete.defaultExpectation = &TagRepositoryMockDeleteExpectation{}
|
|
|
- }
|
|
|
-
|
|
|
- mmDelete.defaultExpectation.params = &TagRepositoryMockDeleteParams{ctx, ID}
|
|
|
- for _, e := range mmDelete.expectations {
|
|
|
- if minimock.Equal(e.params, mmDelete.defaultExpectation.params) {
|
|
|
- mmDelete.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmDelete.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return mmDelete
|
|
|
-}
|
|
|
-
|
|
|
-// Inspect accepts an inspector function that has same arguments as the TagRepository.Delete
|
|
|
-func (mmDelete *mTagRepositoryMockDelete) Inspect(f func(ctx context.Context, ID int)) *mTagRepositoryMockDelete {
|
|
|
- if mmDelete.mock.inspectFuncDelete != nil {
|
|
|
- mmDelete.mock.t.Fatalf("Inspect function is already set for TagRepositoryMock.Delete")
|
|
|
- }
|
|
|
-
|
|
|
- mmDelete.mock.inspectFuncDelete = f
|
|
|
-
|
|
|
- return mmDelete
|
|
|
-}
|
|
|
-
|
|
|
-// Return sets up results that will be returned by TagRepository.Delete
|
|
|
-func (mmDelete *mTagRepositoryMockDelete) Return(err error) *TagRepositoryMock {
|
|
|
- if mmDelete.mock.funcDelete != nil {
|
|
|
- mmDelete.mock.t.Fatalf("TagRepositoryMock.Delete mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmDelete.defaultExpectation == nil {
|
|
|
- mmDelete.defaultExpectation = &TagRepositoryMockDeleteExpectation{mock: mmDelete.mock}
|
|
|
- }
|
|
|
- mmDelete.defaultExpectation.results = &TagRepositoryMockDeleteResults{err}
|
|
|
- return mmDelete.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Set uses given function f to mock the TagRepository.Delete method
|
|
|
-func (mmDelete *mTagRepositoryMockDelete) Set(f func(ctx context.Context, ID int) (err error)) *TagRepositoryMock {
|
|
|
- if mmDelete.defaultExpectation != nil {
|
|
|
- mmDelete.mock.t.Fatalf("Default expectation is already set for the TagRepository.Delete method")
|
|
|
- }
|
|
|
-
|
|
|
- if len(mmDelete.expectations) > 0 {
|
|
|
- mmDelete.mock.t.Fatalf("Some expectations are already set for the TagRepository.Delete method")
|
|
|
- }
|
|
|
-
|
|
|
- mmDelete.mock.funcDelete = f
|
|
|
- return mmDelete.mock
|
|
|
-}
|
|
|
-
|
|
|
-// When sets expectation for the TagRepository.Delete which will trigger the result defined by the following
|
|
|
-// Then helper
|
|
|
-func (mmDelete *mTagRepositoryMockDelete) When(ctx context.Context, ID int) *TagRepositoryMockDeleteExpectation {
|
|
|
- if mmDelete.mock.funcDelete != nil {
|
|
|
- mmDelete.mock.t.Fatalf("TagRepositoryMock.Delete mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- expectation := &TagRepositoryMockDeleteExpectation{
|
|
|
- mock: mmDelete.mock,
|
|
|
- params: &TagRepositoryMockDeleteParams{ctx, ID},
|
|
|
- }
|
|
|
- mmDelete.expectations = append(mmDelete.expectations, expectation)
|
|
|
- return expectation
|
|
|
-}
|
|
|
-
|
|
|
-// Then sets up TagRepository.Delete return parameters for the expectation previously defined by the When method
|
|
|
-func (e *TagRepositoryMockDeleteExpectation) Then(err error) *TagRepositoryMock {
|
|
|
- e.results = &TagRepositoryMockDeleteResults{err}
|
|
|
- return e.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Delete implements interfaces.TagRepository
|
|
|
-func (mmDelete *TagRepositoryMock) Delete(ctx context.Context, ID int) (err error) {
|
|
|
- mm_atomic.AddUint64(&mmDelete.beforeDeleteCounter, 1)
|
|
|
- defer mm_atomic.AddUint64(&mmDelete.afterDeleteCounter, 1)
|
|
|
-
|
|
|
- if mmDelete.inspectFuncDelete != nil {
|
|
|
- mmDelete.inspectFuncDelete(ctx, ID)
|
|
|
- }
|
|
|
-
|
|
|
- mm_params := &TagRepositoryMockDeleteParams{ctx, ID}
|
|
|
-
|
|
|
- // Record call args
|
|
|
- mmDelete.DeleteMock.mutex.Lock()
|
|
|
- mmDelete.DeleteMock.callArgs = append(mmDelete.DeleteMock.callArgs, mm_params)
|
|
|
- mmDelete.DeleteMock.mutex.Unlock()
|
|
|
-
|
|
|
- for _, e := range mmDelete.DeleteMock.expectations {
|
|
|
- if minimock.Equal(e.params, mm_params) {
|
|
|
- mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
- return e.results.err
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if mmDelete.DeleteMock.defaultExpectation != nil {
|
|
|
- mm_atomic.AddUint64(&mmDelete.DeleteMock.defaultExpectation.Counter, 1)
|
|
|
- mm_want := mmDelete.DeleteMock.defaultExpectation.params
|
|
|
- mm_got := TagRepositoryMockDeleteParams{ctx, ID}
|
|
|
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
- mmDelete.t.Errorf("TagRepositoryMock.Delete got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
- }
|
|
|
-
|
|
|
- mm_results := mmDelete.DeleteMock.defaultExpectation.results
|
|
|
- if mm_results == nil {
|
|
|
- mmDelete.t.Fatal("No results are set for the TagRepositoryMock.Delete")
|
|
|
- }
|
|
|
- return (*mm_results).err
|
|
|
- }
|
|
|
- if mmDelete.funcDelete != nil {
|
|
|
- return mmDelete.funcDelete(ctx, ID)
|
|
|
- }
|
|
|
- mmDelete.t.Fatalf("Unexpected call to TagRepositoryMock.Delete. %v %v", ctx, ID)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// DeleteAfterCounter returns a count of finished TagRepositoryMock.Delete invocations
|
|
|
-func (mmDelete *TagRepositoryMock) DeleteAfterCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmDelete.afterDeleteCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// DeleteBeforeCounter returns a count of TagRepositoryMock.Delete invocations
|
|
|
-func (mmDelete *TagRepositoryMock) DeleteBeforeCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmDelete.beforeDeleteCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// Calls returns a list of arguments used in each call to TagRepositoryMock.Delete.
|
|
|
-// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
-func (mmDelete *mTagRepositoryMockDelete) Calls() []*TagRepositoryMockDeleteParams {
|
|
|
- mmDelete.mutex.RLock()
|
|
|
-
|
|
|
- argCopy := make([]*TagRepositoryMockDeleteParams, len(mmDelete.callArgs))
|
|
|
- copy(argCopy, mmDelete.callArgs)
|
|
|
-
|
|
|
- mmDelete.mutex.RUnlock()
|
|
|
-
|
|
|
- return argCopy
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockDeleteDone returns true if the count of the Delete invocations corresponds
|
|
|
-// the number of defined expectations
|
|
|
-func (m *TagRepositoryMock) MinimockDeleteDone() bool {
|
|
|
- for _, e := range m.DeleteMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.DeleteMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcDelete != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockDeleteInspect logs each unmet expectation
|
|
|
-func (m *TagRepositoryMock) MinimockDeleteInspect() {
|
|
|
- for _, e := range m.DeleteMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.Delete with params: %#v", *e.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.DeleteMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
|
|
|
- if m.DeleteMock.defaultExpectation.params == nil {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.Delete")
|
|
|
- } else {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.Delete with params: %#v", *m.DeleteMock.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcDelete != nil && mm_atomic.LoadUint64(&m.afterDeleteCounter) < 1 {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.Delete")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-type mTagRepositoryMockGetAll struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- defaultExpectation *TagRepositoryMockGetAllExpectation
|
|
|
- expectations []*TagRepositoryMockGetAllExpectation
|
|
|
-
|
|
|
- callArgs []*TagRepositoryMockGetAllParams
|
|
|
- mutex sync.RWMutex
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetAllExpectation specifies expectation struct of the TagRepository.GetAll
|
|
|
-type TagRepositoryMockGetAllExpectation struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- params *TagRepositoryMockGetAllParams
|
|
|
- results *TagRepositoryMockGetAllResults
|
|
|
- Counter uint64
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetAllParams contains parameters of the TagRepository.GetAll
|
|
|
-type TagRepositoryMockGetAllParams struct {
|
|
|
- ctx context.Context
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetAllResults contains results of the TagRepository.GetAll
|
|
|
-type TagRepositoryMockGetAllResults struct {
|
|
|
- ta1 []models.Tag
|
|
|
- err error
|
|
|
-}
|
|
|
-
|
|
|
-// Expect sets up expected params for TagRepository.GetAll
|
|
|
-func (mmGetAll *mTagRepositoryMockGetAll) Expect(ctx context.Context) *mTagRepositoryMockGetAll {
|
|
|
- if mmGetAll.mock.funcGetAll != nil {
|
|
|
- mmGetAll.mock.t.Fatalf("TagRepositoryMock.GetAll mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetAll.defaultExpectation == nil {
|
|
|
- mmGetAll.defaultExpectation = &TagRepositoryMockGetAllExpectation{}
|
|
|
- }
|
|
|
-
|
|
|
- mmGetAll.defaultExpectation.params = &TagRepositoryMockGetAllParams{ctx}
|
|
|
- for _, e := range mmGetAll.expectations {
|
|
|
- if minimock.Equal(e.params, mmGetAll.defaultExpectation.params) {
|
|
|
- mmGetAll.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetAll.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return mmGetAll
|
|
|
-}
|
|
|
-
|
|
|
-// Inspect accepts an inspector function that has same arguments as the TagRepository.GetAll
|
|
|
-func (mmGetAll *mTagRepositoryMockGetAll) Inspect(f func(ctx context.Context)) *mTagRepositoryMockGetAll {
|
|
|
- if mmGetAll.mock.inspectFuncGetAll != nil {
|
|
|
- mmGetAll.mock.t.Fatalf("Inspect function is already set for TagRepositoryMock.GetAll")
|
|
|
- }
|
|
|
-
|
|
|
- mmGetAll.mock.inspectFuncGetAll = f
|
|
|
-
|
|
|
- return mmGetAll
|
|
|
-}
|
|
|
-
|
|
|
-// Return sets up results that will be returned by TagRepository.GetAll
|
|
|
-func (mmGetAll *mTagRepositoryMockGetAll) Return(ta1 []models.Tag, err error) *TagRepositoryMock {
|
|
|
- if mmGetAll.mock.funcGetAll != nil {
|
|
|
- mmGetAll.mock.t.Fatalf("TagRepositoryMock.GetAll mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetAll.defaultExpectation == nil {
|
|
|
- mmGetAll.defaultExpectation = &TagRepositoryMockGetAllExpectation{mock: mmGetAll.mock}
|
|
|
- }
|
|
|
- mmGetAll.defaultExpectation.results = &TagRepositoryMockGetAllResults{ta1, err}
|
|
|
- return mmGetAll.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Set uses given function f to mock the TagRepository.GetAll method
|
|
|
-func (mmGetAll *mTagRepositoryMockGetAll) Set(f func(ctx context.Context) (ta1 []models.Tag, err error)) *TagRepositoryMock {
|
|
|
- if mmGetAll.defaultExpectation != nil {
|
|
|
- mmGetAll.mock.t.Fatalf("Default expectation is already set for the TagRepository.GetAll method")
|
|
|
- }
|
|
|
-
|
|
|
- if len(mmGetAll.expectations) > 0 {
|
|
|
- mmGetAll.mock.t.Fatalf("Some expectations are already set for the TagRepository.GetAll method")
|
|
|
- }
|
|
|
-
|
|
|
- mmGetAll.mock.funcGetAll = f
|
|
|
- return mmGetAll.mock
|
|
|
-}
|
|
|
-
|
|
|
-// When sets expectation for the TagRepository.GetAll which will trigger the result defined by the following
|
|
|
-// Then helper
|
|
|
-func (mmGetAll *mTagRepositoryMockGetAll) When(ctx context.Context) *TagRepositoryMockGetAllExpectation {
|
|
|
- if mmGetAll.mock.funcGetAll != nil {
|
|
|
- mmGetAll.mock.t.Fatalf("TagRepositoryMock.GetAll mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- expectation := &TagRepositoryMockGetAllExpectation{
|
|
|
- mock: mmGetAll.mock,
|
|
|
- params: &TagRepositoryMockGetAllParams{ctx},
|
|
|
- }
|
|
|
- mmGetAll.expectations = append(mmGetAll.expectations, expectation)
|
|
|
- return expectation
|
|
|
-}
|
|
|
-
|
|
|
-// Then sets up TagRepository.GetAll return parameters for the expectation previously defined by the When method
|
|
|
-func (e *TagRepositoryMockGetAllExpectation) Then(ta1 []models.Tag, err error) *TagRepositoryMock {
|
|
|
- e.results = &TagRepositoryMockGetAllResults{ta1, err}
|
|
|
- return e.mock
|
|
|
-}
|
|
|
-
|
|
|
-// GetAll implements interfaces.TagRepository
|
|
|
-func (mmGetAll *TagRepositoryMock) GetAll(ctx context.Context) (ta1 []models.Tag, err error) {
|
|
|
- mm_atomic.AddUint64(&mmGetAll.beforeGetAllCounter, 1)
|
|
|
- defer mm_atomic.AddUint64(&mmGetAll.afterGetAllCounter, 1)
|
|
|
-
|
|
|
- if mmGetAll.inspectFuncGetAll != nil {
|
|
|
- mmGetAll.inspectFuncGetAll(ctx)
|
|
|
- }
|
|
|
-
|
|
|
- mm_params := &TagRepositoryMockGetAllParams{ctx}
|
|
|
-
|
|
|
- // Record call args
|
|
|
- mmGetAll.GetAllMock.mutex.Lock()
|
|
|
- mmGetAll.GetAllMock.callArgs = append(mmGetAll.GetAllMock.callArgs, mm_params)
|
|
|
- mmGetAll.GetAllMock.mutex.Unlock()
|
|
|
-
|
|
|
- for _, e := range mmGetAll.GetAllMock.expectations {
|
|
|
- if minimock.Equal(e.params, mm_params) {
|
|
|
- mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
- return e.results.ta1, e.results.err
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetAll.GetAllMock.defaultExpectation != nil {
|
|
|
- mm_atomic.AddUint64(&mmGetAll.GetAllMock.defaultExpectation.Counter, 1)
|
|
|
- mm_want := mmGetAll.GetAllMock.defaultExpectation.params
|
|
|
- mm_got := TagRepositoryMockGetAllParams{ctx}
|
|
|
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
- mmGetAll.t.Errorf("TagRepositoryMock.GetAll got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
- }
|
|
|
-
|
|
|
- mm_results := mmGetAll.GetAllMock.defaultExpectation.results
|
|
|
- if mm_results == nil {
|
|
|
- mmGetAll.t.Fatal("No results are set for the TagRepositoryMock.GetAll")
|
|
|
- }
|
|
|
- return (*mm_results).ta1, (*mm_results).err
|
|
|
- }
|
|
|
- if mmGetAll.funcGetAll != nil {
|
|
|
- return mmGetAll.funcGetAll(ctx)
|
|
|
- }
|
|
|
- mmGetAll.t.Fatalf("Unexpected call to TagRepositoryMock.GetAll. %v", ctx)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// GetAllAfterCounter returns a count of finished TagRepositoryMock.GetAll invocations
|
|
|
-func (mmGetAll *TagRepositoryMock) GetAllAfterCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmGetAll.afterGetAllCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// GetAllBeforeCounter returns a count of TagRepositoryMock.GetAll invocations
|
|
|
-func (mmGetAll *TagRepositoryMock) GetAllBeforeCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmGetAll.beforeGetAllCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// Calls returns a list of arguments used in each call to TagRepositoryMock.GetAll.
|
|
|
-// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
-func (mmGetAll *mTagRepositoryMockGetAll) Calls() []*TagRepositoryMockGetAllParams {
|
|
|
- mmGetAll.mutex.RLock()
|
|
|
-
|
|
|
- argCopy := make([]*TagRepositoryMockGetAllParams, len(mmGetAll.callArgs))
|
|
|
- copy(argCopy, mmGetAll.callArgs)
|
|
|
-
|
|
|
- mmGetAll.mutex.RUnlock()
|
|
|
-
|
|
|
- return argCopy
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockGetAllDone returns true if the count of the GetAll invocations corresponds
|
|
|
-// the number of defined expectations
|
|
|
-func (m *TagRepositoryMock) MinimockGetAllDone() bool {
|
|
|
- for _, e := range m.GetAllMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.GetAllMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetAllCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcGetAll != nil && mm_atomic.LoadUint64(&m.afterGetAllCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockGetAllInspect logs each unmet expectation
|
|
|
-func (m *TagRepositoryMock) MinimockGetAllInspect() {
|
|
|
- for _, e := range m.GetAllMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.GetAll with params: %#v", *e.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.GetAllMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetAllCounter) < 1 {
|
|
|
- if m.GetAllMock.defaultExpectation.params == nil {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.GetAll")
|
|
|
- } else {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.GetAll with params: %#v", *m.GetAllMock.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcGetAll != nil && mm_atomic.LoadUint64(&m.afterGetAllCounter) < 1 {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.GetAll")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-type mTagRepositoryMockGetAllUsed struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- defaultExpectation *TagRepositoryMockGetAllUsedExpectation
|
|
|
- expectations []*TagRepositoryMockGetAllUsedExpectation
|
|
|
-
|
|
|
- callArgs []*TagRepositoryMockGetAllUsedParams
|
|
|
- mutex sync.RWMutex
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetAllUsedExpectation specifies expectation struct of the TagRepository.GetAllUsed
|
|
|
-type TagRepositoryMockGetAllUsedExpectation struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- params *TagRepositoryMockGetAllUsedParams
|
|
|
- results *TagRepositoryMockGetAllUsedResults
|
|
|
- Counter uint64
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetAllUsedParams contains parameters of the TagRepository.GetAllUsed
|
|
|
-type TagRepositoryMockGetAllUsedParams struct {
|
|
|
- ctx context.Context
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetAllUsedResults contains results of the TagRepository.GetAllUsed
|
|
|
-type TagRepositoryMockGetAllUsedResults struct {
|
|
|
- ta1 []models.Tag
|
|
|
- err error
|
|
|
-}
|
|
|
-
|
|
|
-// Expect sets up expected params for TagRepository.GetAllUsed
|
|
|
-func (mmGetAllUsed *mTagRepositoryMockGetAllUsed) Expect(ctx context.Context) *mTagRepositoryMockGetAllUsed {
|
|
|
- if mmGetAllUsed.mock.funcGetAllUsed != nil {
|
|
|
- mmGetAllUsed.mock.t.Fatalf("TagRepositoryMock.GetAllUsed mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetAllUsed.defaultExpectation == nil {
|
|
|
- mmGetAllUsed.defaultExpectation = &TagRepositoryMockGetAllUsedExpectation{}
|
|
|
- }
|
|
|
-
|
|
|
- mmGetAllUsed.defaultExpectation.params = &TagRepositoryMockGetAllUsedParams{ctx}
|
|
|
- for _, e := range mmGetAllUsed.expectations {
|
|
|
- if minimock.Equal(e.params, mmGetAllUsed.defaultExpectation.params) {
|
|
|
- mmGetAllUsed.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetAllUsed.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return mmGetAllUsed
|
|
|
-}
|
|
|
-
|
|
|
-// Inspect accepts an inspector function that has same arguments as the TagRepository.GetAllUsed
|
|
|
-func (mmGetAllUsed *mTagRepositoryMockGetAllUsed) Inspect(f func(ctx context.Context)) *mTagRepositoryMockGetAllUsed {
|
|
|
- if mmGetAllUsed.mock.inspectFuncGetAllUsed != nil {
|
|
|
- mmGetAllUsed.mock.t.Fatalf("Inspect function is already set for TagRepositoryMock.GetAllUsed")
|
|
|
- }
|
|
|
-
|
|
|
- mmGetAllUsed.mock.inspectFuncGetAllUsed = f
|
|
|
-
|
|
|
- return mmGetAllUsed
|
|
|
-}
|
|
|
-
|
|
|
-// Return sets up results that will be returned by TagRepository.GetAllUsed
|
|
|
-func (mmGetAllUsed *mTagRepositoryMockGetAllUsed) Return(ta1 []models.Tag, err error) *TagRepositoryMock {
|
|
|
- if mmGetAllUsed.mock.funcGetAllUsed != nil {
|
|
|
- mmGetAllUsed.mock.t.Fatalf("TagRepositoryMock.GetAllUsed mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetAllUsed.defaultExpectation == nil {
|
|
|
- mmGetAllUsed.defaultExpectation = &TagRepositoryMockGetAllUsedExpectation{mock: mmGetAllUsed.mock}
|
|
|
- }
|
|
|
- mmGetAllUsed.defaultExpectation.results = &TagRepositoryMockGetAllUsedResults{ta1, err}
|
|
|
- return mmGetAllUsed.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Set uses given function f to mock the TagRepository.GetAllUsed method
|
|
|
-func (mmGetAllUsed *mTagRepositoryMockGetAllUsed) Set(f func(ctx context.Context) (ta1 []models.Tag, err error)) *TagRepositoryMock {
|
|
|
- if mmGetAllUsed.defaultExpectation != nil {
|
|
|
- mmGetAllUsed.mock.t.Fatalf("Default expectation is already set for the TagRepository.GetAllUsed method")
|
|
|
- }
|
|
|
-
|
|
|
- if len(mmGetAllUsed.expectations) > 0 {
|
|
|
- mmGetAllUsed.mock.t.Fatalf("Some expectations are already set for the TagRepository.GetAllUsed method")
|
|
|
- }
|
|
|
-
|
|
|
- mmGetAllUsed.mock.funcGetAllUsed = f
|
|
|
- return mmGetAllUsed.mock
|
|
|
-}
|
|
|
-
|
|
|
-// When sets expectation for the TagRepository.GetAllUsed which will trigger the result defined by the following
|
|
|
-// Then helper
|
|
|
-func (mmGetAllUsed *mTagRepositoryMockGetAllUsed) When(ctx context.Context) *TagRepositoryMockGetAllUsedExpectation {
|
|
|
- if mmGetAllUsed.mock.funcGetAllUsed != nil {
|
|
|
- mmGetAllUsed.mock.t.Fatalf("TagRepositoryMock.GetAllUsed mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- expectation := &TagRepositoryMockGetAllUsedExpectation{
|
|
|
- mock: mmGetAllUsed.mock,
|
|
|
- params: &TagRepositoryMockGetAllUsedParams{ctx},
|
|
|
- }
|
|
|
- mmGetAllUsed.expectations = append(mmGetAllUsed.expectations, expectation)
|
|
|
- return expectation
|
|
|
-}
|
|
|
-
|
|
|
-// Then sets up TagRepository.GetAllUsed return parameters for the expectation previously defined by the When method
|
|
|
-func (e *TagRepositoryMockGetAllUsedExpectation) Then(ta1 []models.Tag, err error) *TagRepositoryMock {
|
|
|
- e.results = &TagRepositoryMockGetAllUsedResults{ta1, err}
|
|
|
- return e.mock
|
|
|
-}
|
|
|
-
|
|
|
-// GetAllUsed implements interfaces.TagRepository
|
|
|
-func (mmGetAllUsed *TagRepositoryMock) GetAllUsed(ctx context.Context) (ta1 []models.Tag, err error) {
|
|
|
- mm_atomic.AddUint64(&mmGetAllUsed.beforeGetAllUsedCounter, 1)
|
|
|
- defer mm_atomic.AddUint64(&mmGetAllUsed.afterGetAllUsedCounter, 1)
|
|
|
-
|
|
|
- if mmGetAllUsed.inspectFuncGetAllUsed != nil {
|
|
|
- mmGetAllUsed.inspectFuncGetAllUsed(ctx)
|
|
|
- }
|
|
|
-
|
|
|
- mm_params := &TagRepositoryMockGetAllUsedParams{ctx}
|
|
|
-
|
|
|
- // Record call args
|
|
|
- mmGetAllUsed.GetAllUsedMock.mutex.Lock()
|
|
|
- mmGetAllUsed.GetAllUsedMock.callArgs = append(mmGetAllUsed.GetAllUsedMock.callArgs, mm_params)
|
|
|
- mmGetAllUsed.GetAllUsedMock.mutex.Unlock()
|
|
|
-
|
|
|
- for _, e := range mmGetAllUsed.GetAllUsedMock.expectations {
|
|
|
- if minimock.Equal(e.params, mm_params) {
|
|
|
- mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
- return e.results.ta1, e.results.err
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetAllUsed.GetAllUsedMock.defaultExpectation != nil {
|
|
|
- mm_atomic.AddUint64(&mmGetAllUsed.GetAllUsedMock.defaultExpectation.Counter, 1)
|
|
|
- mm_want := mmGetAllUsed.GetAllUsedMock.defaultExpectation.params
|
|
|
- mm_got := TagRepositoryMockGetAllUsedParams{ctx}
|
|
|
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
- mmGetAllUsed.t.Errorf("TagRepositoryMock.GetAllUsed got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
- }
|
|
|
-
|
|
|
- mm_results := mmGetAllUsed.GetAllUsedMock.defaultExpectation.results
|
|
|
- if mm_results == nil {
|
|
|
- mmGetAllUsed.t.Fatal("No results are set for the TagRepositoryMock.GetAllUsed")
|
|
|
- }
|
|
|
- return (*mm_results).ta1, (*mm_results).err
|
|
|
- }
|
|
|
- if mmGetAllUsed.funcGetAllUsed != nil {
|
|
|
- return mmGetAllUsed.funcGetAllUsed(ctx)
|
|
|
- }
|
|
|
- mmGetAllUsed.t.Fatalf("Unexpected call to TagRepositoryMock.GetAllUsed. %v", ctx)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// GetAllUsedAfterCounter returns a count of finished TagRepositoryMock.GetAllUsed invocations
|
|
|
-func (mmGetAllUsed *TagRepositoryMock) GetAllUsedAfterCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmGetAllUsed.afterGetAllUsedCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// GetAllUsedBeforeCounter returns a count of TagRepositoryMock.GetAllUsed invocations
|
|
|
-func (mmGetAllUsed *TagRepositoryMock) GetAllUsedBeforeCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmGetAllUsed.beforeGetAllUsedCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// Calls returns a list of arguments used in each call to TagRepositoryMock.GetAllUsed.
|
|
|
-// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
-func (mmGetAllUsed *mTagRepositoryMockGetAllUsed) Calls() []*TagRepositoryMockGetAllUsedParams {
|
|
|
- mmGetAllUsed.mutex.RLock()
|
|
|
-
|
|
|
- argCopy := make([]*TagRepositoryMockGetAllUsedParams, len(mmGetAllUsed.callArgs))
|
|
|
- copy(argCopy, mmGetAllUsed.callArgs)
|
|
|
-
|
|
|
- mmGetAllUsed.mutex.RUnlock()
|
|
|
-
|
|
|
- return argCopy
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockGetAllUsedDone returns true if the count of the GetAllUsed invocations corresponds
|
|
|
-// the number of defined expectations
|
|
|
-func (m *TagRepositoryMock) MinimockGetAllUsedDone() bool {
|
|
|
- for _, e := range m.GetAllUsedMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.GetAllUsedMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetAllUsedCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcGetAllUsed != nil && mm_atomic.LoadUint64(&m.afterGetAllUsedCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockGetAllUsedInspect logs each unmet expectation
|
|
|
-func (m *TagRepositoryMock) MinimockGetAllUsedInspect() {
|
|
|
- for _, e := range m.GetAllUsedMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.GetAllUsed with params: %#v", *e.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.GetAllUsedMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetAllUsedCounter) < 1 {
|
|
|
- if m.GetAllUsedMock.defaultExpectation.params == nil {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.GetAllUsed")
|
|
|
- } else {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.GetAllUsed with params: %#v", *m.GetAllUsedMock.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcGetAllUsed != nil && mm_atomic.LoadUint64(&m.afterGetAllUsedCounter) < 1 {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.GetAllUsed")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-type mTagRepositoryMockGetByArticleID struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- defaultExpectation *TagRepositoryMockGetByArticleIDExpectation
|
|
|
- expectations []*TagRepositoryMockGetByArticleIDExpectation
|
|
|
-
|
|
|
- callArgs []*TagRepositoryMockGetByArticleIDParams
|
|
|
- mutex sync.RWMutex
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetByArticleIDExpectation specifies expectation struct of the TagRepository.GetByArticleID
|
|
|
-type TagRepositoryMockGetByArticleIDExpectation struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- params *TagRepositoryMockGetByArticleIDParams
|
|
|
- results *TagRepositoryMockGetByArticleIDResults
|
|
|
- Counter uint64
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetByArticleIDParams contains parameters of the TagRepository.GetByArticleID
|
|
|
-type TagRepositoryMockGetByArticleIDParams struct {
|
|
|
- ctx context.Context
|
|
|
- ID int
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetByArticleIDResults contains results of the TagRepository.GetByArticleID
|
|
|
-type TagRepositoryMockGetByArticleIDResults struct {
|
|
|
- ta1 []models.Tag
|
|
|
- err error
|
|
|
-}
|
|
|
-
|
|
|
-// Expect sets up expected params for TagRepository.GetByArticleID
|
|
|
-func (mmGetByArticleID *mTagRepositoryMockGetByArticleID) Expect(ctx context.Context, ID int) *mTagRepositoryMockGetByArticleID {
|
|
|
- if mmGetByArticleID.mock.funcGetByArticleID != nil {
|
|
|
- mmGetByArticleID.mock.t.Fatalf("TagRepositoryMock.GetByArticleID mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetByArticleID.defaultExpectation == nil {
|
|
|
- mmGetByArticleID.defaultExpectation = &TagRepositoryMockGetByArticleIDExpectation{}
|
|
|
- }
|
|
|
-
|
|
|
- mmGetByArticleID.defaultExpectation.params = &TagRepositoryMockGetByArticleIDParams{ctx, ID}
|
|
|
- for _, e := range mmGetByArticleID.expectations {
|
|
|
- if minimock.Equal(e.params, mmGetByArticleID.defaultExpectation.params) {
|
|
|
- mmGetByArticleID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByArticleID.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return mmGetByArticleID
|
|
|
-}
|
|
|
-
|
|
|
-// Inspect accepts an inspector function that has same arguments as the TagRepository.GetByArticleID
|
|
|
-func (mmGetByArticleID *mTagRepositoryMockGetByArticleID) Inspect(f func(ctx context.Context, ID int)) *mTagRepositoryMockGetByArticleID {
|
|
|
- if mmGetByArticleID.mock.inspectFuncGetByArticleID != nil {
|
|
|
- mmGetByArticleID.mock.t.Fatalf("Inspect function is already set for TagRepositoryMock.GetByArticleID")
|
|
|
- }
|
|
|
-
|
|
|
- mmGetByArticleID.mock.inspectFuncGetByArticleID = f
|
|
|
-
|
|
|
- return mmGetByArticleID
|
|
|
-}
|
|
|
-
|
|
|
-// Return sets up results that will be returned by TagRepository.GetByArticleID
|
|
|
-func (mmGetByArticleID *mTagRepositoryMockGetByArticleID) Return(ta1 []models.Tag, err error) *TagRepositoryMock {
|
|
|
- if mmGetByArticleID.mock.funcGetByArticleID != nil {
|
|
|
- mmGetByArticleID.mock.t.Fatalf("TagRepositoryMock.GetByArticleID mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetByArticleID.defaultExpectation == nil {
|
|
|
- mmGetByArticleID.defaultExpectation = &TagRepositoryMockGetByArticleIDExpectation{mock: mmGetByArticleID.mock}
|
|
|
- }
|
|
|
- mmGetByArticleID.defaultExpectation.results = &TagRepositoryMockGetByArticleIDResults{ta1, err}
|
|
|
- return mmGetByArticleID.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Set uses given function f to mock the TagRepository.GetByArticleID method
|
|
|
-func (mmGetByArticleID *mTagRepositoryMockGetByArticleID) Set(f func(ctx context.Context, ID int) (ta1 []models.Tag, err error)) *TagRepositoryMock {
|
|
|
- if mmGetByArticleID.defaultExpectation != nil {
|
|
|
- mmGetByArticleID.mock.t.Fatalf("Default expectation is already set for the TagRepository.GetByArticleID method")
|
|
|
- }
|
|
|
-
|
|
|
- if len(mmGetByArticleID.expectations) > 0 {
|
|
|
- mmGetByArticleID.mock.t.Fatalf("Some expectations are already set for the TagRepository.GetByArticleID method")
|
|
|
- }
|
|
|
-
|
|
|
- mmGetByArticleID.mock.funcGetByArticleID = f
|
|
|
- return mmGetByArticleID.mock
|
|
|
-}
|
|
|
-
|
|
|
-// When sets expectation for the TagRepository.GetByArticleID which will trigger the result defined by the following
|
|
|
-// Then helper
|
|
|
-func (mmGetByArticleID *mTagRepositoryMockGetByArticleID) When(ctx context.Context, ID int) *TagRepositoryMockGetByArticleIDExpectation {
|
|
|
- if mmGetByArticleID.mock.funcGetByArticleID != nil {
|
|
|
- mmGetByArticleID.mock.t.Fatalf("TagRepositoryMock.GetByArticleID mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- expectation := &TagRepositoryMockGetByArticleIDExpectation{
|
|
|
- mock: mmGetByArticleID.mock,
|
|
|
- params: &TagRepositoryMockGetByArticleIDParams{ctx, ID},
|
|
|
- }
|
|
|
- mmGetByArticleID.expectations = append(mmGetByArticleID.expectations, expectation)
|
|
|
- return expectation
|
|
|
-}
|
|
|
-
|
|
|
-// Then sets up TagRepository.GetByArticleID return parameters for the expectation previously defined by the When method
|
|
|
-func (e *TagRepositoryMockGetByArticleIDExpectation) Then(ta1 []models.Tag, err error) *TagRepositoryMock {
|
|
|
- e.results = &TagRepositoryMockGetByArticleIDResults{ta1, err}
|
|
|
- return e.mock
|
|
|
-}
|
|
|
-
|
|
|
-// GetByArticleID implements interfaces.TagRepository
|
|
|
-func (mmGetByArticleID *TagRepositoryMock) GetByArticleID(ctx context.Context, ID int) (ta1 []models.Tag, err error) {
|
|
|
- mm_atomic.AddUint64(&mmGetByArticleID.beforeGetByArticleIDCounter, 1)
|
|
|
- defer mm_atomic.AddUint64(&mmGetByArticleID.afterGetByArticleIDCounter, 1)
|
|
|
-
|
|
|
- if mmGetByArticleID.inspectFuncGetByArticleID != nil {
|
|
|
- mmGetByArticleID.inspectFuncGetByArticleID(ctx, ID)
|
|
|
- }
|
|
|
-
|
|
|
- mm_params := &TagRepositoryMockGetByArticleIDParams{ctx, ID}
|
|
|
-
|
|
|
- // Record call args
|
|
|
- mmGetByArticleID.GetByArticleIDMock.mutex.Lock()
|
|
|
- mmGetByArticleID.GetByArticleIDMock.callArgs = append(mmGetByArticleID.GetByArticleIDMock.callArgs, mm_params)
|
|
|
- mmGetByArticleID.GetByArticleIDMock.mutex.Unlock()
|
|
|
-
|
|
|
- for _, e := range mmGetByArticleID.GetByArticleIDMock.expectations {
|
|
|
- if minimock.Equal(e.params, mm_params) {
|
|
|
- mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
- return e.results.ta1, e.results.err
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetByArticleID.GetByArticleIDMock.defaultExpectation != nil {
|
|
|
- mm_atomic.AddUint64(&mmGetByArticleID.GetByArticleIDMock.defaultExpectation.Counter, 1)
|
|
|
- mm_want := mmGetByArticleID.GetByArticleIDMock.defaultExpectation.params
|
|
|
- mm_got := TagRepositoryMockGetByArticleIDParams{ctx, ID}
|
|
|
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
- mmGetByArticleID.t.Errorf("TagRepositoryMock.GetByArticleID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
- }
|
|
|
-
|
|
|
- mm_results := mmGetByArticleID.GetByArticleIDMock.defaultExpectation.results
|
|
|
- if mm_results == nil {
|
|
|
- mmGetByArticleID.t.Fatal("No results are set for the TagRepositoryMock.GetByArticleID")
|
|
|
- }
|
|
|
- return (*mm_results).ta1, (*mm_results).err
|
|
|
- }
|
|
|
- if mmGetByArticleID.funcGetByArticleID != nil {
|
|
|
- return mmGetByArticleID.funcGetByArticleID(ctx, ID)
|
|
|
- }
|
|
|
- mmGetByArticleID.t.Fatalf("Unexpected call to TagRepositoryMock.GetByArticleID. %v %v", ctx, ID)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// GetByArticleIDAfterCounter returns a count of finished TagRepositoryMock.GetByArticleID invocations
|
|
|
-func (mmGetByArticleID *TagRepositoryMock) GetByArticleIDAfterCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmGetByArticleID.afterGetByArticleIDCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// GetByArticleIDBeforeCounter returns a count of TagRepositoryMock.GetByArticleID invocations
|
|
|
-func (mmGetByArticleID *TagRepositoryMock) GetByArticleIDBeforeCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmGetByArticleID.beforeGetByArticleIDCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// Calls returns a list of arguments used in each call to TagRepositoryMock.GetByArticleID.
|
|
|
-// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
-func (mmGetByArticleID *mTagRepositoryMockGetByArticleID) Calls() []*TagRepositoryMockGetByArticleIDParams {
|
|
|
- mmGetByArticleID.mutex.RLock()
|
|
|
-
|
|
|
- argCopy := make([]*TagRepositoryMockGetByArticleIDParams, len(mmGetByArticleID.callArgs))
|
|
|
- copy(argCopy, mmGetByArticleID.callArgs)
|
|
|
-
|
|
|
- mmGetByArticleID.mutex.RUnlock()
|
|
|
-
|
|
|
- return argCopy
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockGetByArticleIDDone returns true if the count of the GetByArticleID invocations corresponds
|
|
|
-// the number of defined expectations
|
|
|
-func (m *TagRepositoryMock) MinimockGetByArticleIDDone() bool {
|
|
|
- for _, e := range m.GetByArticleIDMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.GetByArticleIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByArticleIDCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcGetByArticleID != nil && mm_atomic.LoadUint64(&m.afterGetByArticleIDCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockGetByArticleIDInspect logs each unmet expectation
|
|
|
-func (m *TagRepositoryMock) MinimockGetByArticleIDInspect() {
|
|
|
- for _, e := range m.GetByArticleIDMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.GetByArticleID with params: %#v", *e.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.GetByArticleIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByArticleIDCounter) < 1 {
|
|
|
- if m.GetByArticleIDMock.defaultExpectation.params == nil {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.GetByArticleID")
|
|
|
- } else {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.GetByArticleID with params: %#v", *m.GetByArticleIDMock.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcGetByArticleID != nil && mm_atomic.LoadUint64(&m.afterGetByArticleIDCounter) < 1 {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.GetByArticleID")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-type mTagRepositoryMockGetByID struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- defaultExpectation *TagRepositoryMockGetByIDExpectation
|
|
|
- expectations []*TagRepositoryMockGetByIDExpectation
|
|
|
-
|
|
|
- callArgs []*TagRepositoryMockGetByIDParams
|
|
|
- mutex sync.RWMutex
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetByIDExpectation specifies expectation struct of the TagRepository.GetByID
|
|
|
-type TagRepositoryMockGetByIDExpectation struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- params *TagRepositoryMockGetByIDParams
|
|
|
- results *TagRepositoryMockGetByIDResults
|
|
|
- Counter uint64
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetByIDParams contains parameters of the TagRepository.GetByID
|
|
|
-type TagRepositoryMockGetByIDParams struct {
|
|
|
- ctx context.Context
|
|
|
- ID int
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetByIDResults contains results of the TagRepository.GetByID
|
|
|
-type TagRepositoryMockGetByIDResults struct {
|
|
|
- tp1 *models.Tag
|
|
|
- err error
|
|
|
-}
|
|
|
-
|
|
|
-// Expect sets up expected params for TagRepository.GetByID
|
|
|
-func (mmGetByID *mTagRepositoryMockGetByID) Expect(ctx context.Context, ID int) *mTagRepositoryMockGetByID {
|
|
|
- if mmGetByID.mock.funcGetByID != nil {
|
|
|
- mmGetByID.mock.t.Fatalf("TagRepositoryMock.GetByID mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetByID.defaultExpectation == nil {
|
|
|
- mmGetByID.defaultExpectation = &TagRepositoryMockGetByIDExpectation{}
|
|
|
- }
|
|
|
-
|
|
|
- mmGetByID.defaultExpectation.params = &TagRepositoryMockGetByIDParams{ctx, ID}
|
|
|
- for _, e := range mmGetByID.expectations {
|
|
|
- if minimock.Equal(e.params, mmGetByID.defaultExpectation.params) {
|
|
|
- mmGetByID.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByID.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return mmGetByID
|
|
|
-}
|
|
|
-
|
|
|
-// Inspect accepts an inspector function that has same arguments as the TagRepository.GetByID
|
|
|
-func (mmGetByID *mTagRepositoryMockGetByID) Inspect(f func(ctx context.Context, ID int)) *mTagRepositoryMockGetByID {
|
|
|
- if mmGetByID.mock.inspectFuncGetByID != nil {
|
|
|
- mmGetByID.mock.t.Fatalf("Inspect function is already set for TagRepositoryMock.GetByID")
|
|
|
- }
|
|
|
-
|
|
|
- mmGetByID.mock.inspectFuncGetByID = f
|
|
|
-
|
|
|
- return mmGetByID
|
|
|
-}
|
|
|
-
|
|
|
-// Return sets up results that will be returned by TagRepository.GetByID
|
|
|
-func (mmGetByID *mTagRepositoryMockGetByID) Return(tp1 *models.Tag, err error) *TagRepositoryMock {
|
|
|
- if mmGetByID.mock.funcGetByID != nil {
|
|
|
- mmGetByID.mock.t.Fatalf("TagRepositoryMock.GetByID mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetByID.defaultExpectation == nil {
|
|
|
- mmGetByID.defaultExpectation = &TagRepositoryMockGetByIDExpectation{mock: mmGetByID.mock}
|
|
|
- }
|
|
|
- mmGetByID.defaultExpectation.results = &TagRepositoryMockGetByIDResults{tp1, err}
|
|
|
- return mmGetByID.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Set uses given function f to mock the TagRepository.GetByID method
|
|
|
-func (mmGetByID *mTagRepositoryMockGetByID) Set(f func(ctx context.Context, ID int) (tp1 *models.Tag, err error)) *TagRepositoryMock {
|
|
|
- if mmGetByID.defaultExpectation != nil {
|
|
|
- mmGetByID.mock.t.Fatalf("Default expectation is already set for the TagRepository.GetByID method")
|
|
|
- }
|
|
|
-
|
|
|
- if len(mmGetByID.expectations) > 0 {
|
|
|
- mmGetByID.mock.t.Fatalf("Some expectations are already set for the TagRepository.GetByID method")
|
|
|
- }
|
|
|
-
|
|
|
- mmGetByID.mock.funcGetByID = f
|
|
|
- return mmGetByID.mock
|
|
|
-}
|
|
|
-
|
|
|
-// When sets expectation for the TagRepository.GetByID which will trigger the result defined by the following
|
|
|
-// Then helper
|
|
|
-func (mmGetByID *mTagRepositoryMockGetByID) When(ctx context.Context, ID int) *TagRepositoryMockGetByIDExpectation {
|
|
|
- if mmGetByID.mock.funcGetByID != nil {
|
|
|
- mmGetByID.mock.t.Fatalf("TagRepositoryMock.GetByID mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- expectation := &TagRepositoryMockGetByIDExpectation{
|
|
|
- mock: mmGetByID.mock,
|
|
|
- params: &TagRepositoryMockGetByIDParams{ctx, ID},
|
|
|
- }
|
|
|
- mmGetByID.expectations = append(mmGetByID.expectations, expectation)
|
|
|
- return expectation
|
|
|
-}
|
|
|
-
|
|
|
-// Then sets up TagRepository.GetByID return parameters for the expectation previously defined by the When method
|
|
|
-func (e *TagRepositoryMockGetByIDExpectation) Then(tp1 *models.Tag, err error) *TagRepositoryMock {
|
|
|
- e.results = &TagRepositoryMockGetByIDResults{tp1, err}
|
|
|
- return e.mock
|
|
|
-}
|
|
|
-
|
|
|
-// GetByID implements interfaces.TagRepository
|
|
|
-func (mmGetByID *TagRepositoryMock) GetByID(ctx context.Context, ID int) (tp1 *models.Tag, err error) {
|
|
|
- mm_atomic.AddUint64(&mmGetByID.beforeGetByIDCounter, 1)
|
|
|
- defer mm_atomic.AddUint64(&mmGetByID.afterGetByIDCounter, 1)
|
|
|
-
|
|
|
- if mmGetByID.inspectFuncGetByID != nil {
|
|
|
- mmGetByID.inspectFuncGetByID(ctx, ID)
|
|
|
- }
|
|
|
-
|
|
|
- mm_params := &TagRepositoryMockGetByIDParams{ctx, ID}
|
|
|
-
|
|
|
- // Record call args
|
|
|
- mmGetByID.GetByIDMock.mutex.Lock()
|
|
|
- mmGetByID.GetByIDMock.callArgs = append(mmGetByID.GetByIDMock.callArgs, mm_params)
|
|
|
- mmGetByID.GetByIDMock.mutex.Unlock()
|
|
|
-
|
|
|
- for _, e := range mmGetByID.GetByIDMock.expectations {
|
|
|
- if minimock.Equal(e.params, mm_params) {
|
|
|
- mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
- return e.results.tp1, e.results.err
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetByID.GetByIDMock.defaultExpectation != nil {
|
|
|
- mm_atomic.AddUint64(&mmGetByID.GetByIDMock.defaultExpectation.Counter, 1)
|
|
|
- mm_want := mmGetByID.GetByIDMock.defaultExpectation.params
|
|
|
- mm_got := TagRepositoryMockGetByIDParams{ctx, ID}
|
|
|
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
- mmGetByID.t.Errorf("TagRepositoryMock.GetByID got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
- }
|
|
|
-
|
|
|
- mm_results := mmGetByID.GetByIDMock.defaultExpectation.results
|
|
|
- if mm_results == nil {
|
|
|
- mmGetByID.t.Fatal("No results are set for the TagRepositoryMock.GetByID")
|
|
|
- }
|
|
|
- return (*mm_results).tp1, (*mm_results).err
|
|
|
- }
|
|
|
- if mmGetByID.funcGetByID != nil {
|
|
|
- return mmGetByID.funcGetByID(ctx, ID)
|
|
|
- }
|
|
|
- mmGetByID.t.Fatalf("Unexpected call to TagRepositoryMock.GetByID. %v %v", ctx, ID)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// GetByIDAfterCounter returns a count of finished TagRepositoryMock.GetByID invocations
|
|
|
-func (mmGetByID *TagRepositoryMock) GetByIDAfterCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmGetByID.afterGetByIDCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// GetByIDBeforeCounter returns a count of TagRepositoryMock.GetByID invocations
|
|
|
-func (mmGetByID *TagRepositoryMock) GetByIDBeforeCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmGetByID.beforeGetByIDCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// Calls returns a list of arguments used in each call to TagRepositoryMock.GetByID.
|
|
|
-// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
-func (mmGetByID *mTagRepositoryMockGetByID) Calls() []*TagRepositoryMockGetByIDParams {
|
|
|
- mmGetByID.mutex.RLock()
|
|
|
-
|
|
|
- argCopy := make([]*TagRepositoryMockGetByIDParams, len(mmGetByID.callArgs))
|
|
|
- copy(argCopy, mmGetByID.callArgs)
|
|
|
-
|
|
|
- mmGetByID.mutex.RUnlock()
|
|
|
-
|
|
|
- return argCopy
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockGetByIDDone returns true if the count of the GetByID invocations corresponds
|
|
|
-// the number of defined expectations
|
|
|
-func (m *TagRepositoryMock) MinimockGetByIDDone() bool {
|
|
|
- for _, e := range m.GetByIDMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.GetByIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByIDCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcGetByID != nil && mm_atomic.LoadUint64(&m.afterGetByIDCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockGetByIDInspect logs each unmet expectation
|
|
|
-func (m *TagRepositoryMock) MinimockGetByIDInspect() {
|
|
|
- for _, e := range m.GetByIDMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.GetByID with params: %#v", *e.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.GetByIDMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByIDCounter) < 1 {
|
|
|
- if m.GetByIDMock.defaultExpectation.params == nil {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.GetByID")
|
|
|
- } else {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.GetByID with params: %#v", *m.GetByIDMock.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcGetByID != nil && mm_atomic.LoadUint64(&m.afterGetByIDCounter) < 1 {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.GetByID")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-type mTagRepositoryMockGetByURL struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- defaultExpectation *TagRepositoryMockGetByURLExpectation
|
|
|
- expectations []*TagRepositoryMockGetByURLExpectation
|
|
|
-
|
|
|
- callArgs []*TagRepositoryMockGetByURLParams
|
|
|
- mutex sync.RWMutex
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetByURLExpectation specifies expectation struct of the TagRepository.GetByURL
|
|
|
-type TagRepositoryMockGetByURLExpectation struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- params *TagRepositoryMockGetByURLParams
|
|
|
- results *TagRepositoryMockGetByURLResults
|
|
|
- Counter uint64
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetByURLParams contains parameters of the TagRepository.GetByURL
|
|
|
-type TagRepositoryMockGetByURLParams struct {
|
|
|
- ctx context.Context
|
|
|
- tag string
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockGetByURLResults contains results of the TagRepository.GetByURL
|
|
|
-type TagRepositoryMockGetByURLResults struct {
|
|
|
- tp1 *models.Tag
|
|
|
- err error
|
|
|
-}
|
|
|
-
|
|
|
-// Expect sets up expected params for TagRepository.GetByURL
|
|
|
-func (mmGetByURL *mTagRepositoryMockGetByURL) Expect(ctx context.Context, tag string) *mTagRepositoryMockGetByURL {
|
|
|
- if mmGetByURL.mock.funcGetByURL != nil {
|
|
|
- mmGetByURL.mock.t.Fatalf("TagRepositoryMock.GetByURL mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetByURL.defaultExpectation == nil {
|
|
|
- mmGetByURL.defaultExpectation = &TagRepositoryMockGetByURLExpectation{}
|
|
|
- }
|
|
|
-
|
|
|
- mmGetByURL.defaultExpectation.params = &TagRepositoryMockGetByURLParams{ctx, tag}
|
|
|
- for _, e := range mmGetByURL.expectations {
|
|
|
- if minimock.Equal(e.params, mmGetByURL.defaultExpectation.params) {
|
|
|
- mmGetByURL.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetByURL.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return mmGetByURL
|
|
|
-}
|
|
|
-
|
|
|
-// Inspect accepts an inspector function that has same arguments as the TagRepository.GetByURL
|
|
|
-func (mmGetByURL *mTagRepositoryMockGetByURL) Inspect(f func(ctx context.Context, tag string)) *mTagRepositoryMockGetByURL {
|
|
|
- if mmGetByURL.mock.inspectFuncGetByURL != nil {
|
|
|
- mmGetByURL.mock.t.Fatalf("Inspect function is already set for TagRepositoryMock.GetByURL")
|
|
|
- }
|
|
|
-
|
|
|
- mmGetByURL.mock.inspectFuncGetByURL = f
|
|
|
-
|
|
|
- return mmGetByURL
|
|
|
-}
|
|
|
-
|
|
|
-// Return sets up results that will be returned by TagRepository.GetByURL
|
|
|
-func (mmGetByURL *mTagRepositoryMockGetByURL) Return(tp1 *models.Tag, err error) *TagRepositoryMock {
|
|
|
- if mmGetByURL.mock.funcGetByURL != nil {
|
|
|
- mmGetByURL.mock.t.Fatalf("TagRepositoryMock.GetByURL mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetByURL.defaultExpectation == nil {
|
|
|
- mmGetByURL.defaultExpectation = &TagRepositoryMockGetByURLExpectation{mock: mmGetByURL.mock}
|
|
|
- }
|
|
|
- mmGetByURL.defaultExpectation.results = &TagRepositoryMockGetByURLResults{tp1, err}
|
|
|
- return mmGetByURL.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Set uses given function f to mock the TagRepository.GetByURL method
|
|
|
-func (mmGetByURL *mTagRepositoryMockGetByURL) Set(f func(ctx context.Context, tag string) (tp1 *models.Tag, err error)) *TagRepositoryMock {
|
|
|
- if mmGetByURL.defaultExpectation != nil {
|
|
|
- mmGetByURL.mock.t.Fatalf("Default expectation is already set for the TagRepository.GetByURL method")
|
|
|
- }
|
|
|
-
|
|
|
- if len(mmGetByURL.expectations) > 0 {
|
|
|
- mmGetByURL.mock.t.Fatalf("Some expectations are already set for the TagRepository.GetByURL method")
|
|
|
- }
|
|
|
-
|
|
|
- mmGetByURL.mock.funcGetByURL = f
|
|
|
- return mmGetByURL.mock
|
|
|
-}
|
|
|
-
|
|
|
-// When sets expectation for the TagRepository.GetByURL which will trigger the result defined by the following
|
|
|
-// Then helper
|
|
|
-func (mmGetByURL *mTagRepositoryMockGetByURL) When(ctx context.Context, tag string) *TagRepositoryMockGetByURLExpectation {
|
|
|
- if mmGetByURL.mock.funcGetByURL != nil {
|
|
|
- mmGetByURL.mock.t.Fatalf("TagRepositoryMock.GetByURL mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- expectation := &TagRepositoryMockGetByURLExpectation{
|
|
|
- mock: mmGetByURL.mock,
|
|
|
- params: &TagRepositoryMockGetByURLParams{ctx, tag},
|
|
|
- }
|
|
|
- mmGetByURL.expectations = append(mmGetByURL.expectations, expectation)
|
|
|
- return expectation
|
|
|
-}
|
|
|
-
|
|
|
-// Then sets up TagRepository.GetByURL return parameters for the expectation previously defined by the When method
|
|
|
-func (e *TagRepositoryMockGetByURLExpectation) Then(tp1 *models.Tag, err error) *TagRepositoryMock {
|
|
|
- e.results = &TagRepositoryMockGetByURLResults{tp1, err}
|
|
|
- return e.mock
|
|
|
-}
|
|
|
-
|
|
|
-// GetByURL implements interfaces.TagRepository
|
|
|
-func (mmGetByURL *TagRepositoryMock) GetByURL(ctx context.Context, tag string) (tp1 *models.Tag, err error) {
|
|
|
- mm_atomic.AddUint64(&mmGetByURL.beforeGetByURLCounter, 1)
|
|
|
- defer mm_atomic.AddUint64(&mmGetByURL.afterGetByURLCounter, 1)
|
|
|
-
|
|
|
- if mmGetByURL.inspectFuncGetByURL != nil {
|
|
|
- mmGetByURL.inspectFuncGetByURL(ctx, tag)
|
|
|
- }
|
|
|
-
|
|
|
- mm_params := &TagRepositoryMockGetByURLParams{ctx, tag}
|
|
|
-
|
|
|
- // Record call args
|
|
|
- mmGetByURL.GetByURLMock.mutex.Lock()
|
|
|
- mmGetByURL.GetByURLMock.callArgs = append(mmGetByURL.GetByURLMock.callArgs, mm_params)
|
|
|
- mmGetByURL.GetByURLMock.mutex.Unlock()
|
|
|
-
|
|
|
- for _, e := range mmGetByURL.GetByURLMock.expectations {
|
|
|
- if minimock.Equal(e.params, mm_params) {
|
|
|
- mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
- return e.results.tp1, e.results.err
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if mmGetByURL.GetByURLMock.defaultExpectation != nil {
|
|
|
- mm_atomic.AddUint64(&mmGetByURL.GetByURLMock.defaultExpectation.Counter, 1)
|
|
|
- mm_want := mmGetByURL.GetByURLMock.defaultExpectation.params
|
|
|
- mm_got := TagRepositoryMockGetByURLParams{ctx, tag}
|
|
|
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
- mmGetByURL.t.Errorf("TagRepositoryMock.GetByURL got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
- }
|
|
|
-
|
|
|
- mm_results := mmGetByURL.GetByURLMock.defaultExpectation.results
|
|
|
- if mm_results == nil {
|
|
|
- mmGetByURL.t.Fatal("No results are set for the TagRepositoryMock.GetByURL")
|
|
|
- }
|
|
|
- return (*mm_results).tp1, (*mm_results).err
|
|
|
- }
|
|
|
- if mmGetByURL.funcGetByURL != nil {
|
|
|
- return mmGetByURL.funcGetByURL(ctx, tag)
|
|
|
- }
|
|
|
- mmGetByURL.t.Fatalf("Unexpected call to TagRepositoryMock.GetByURL. %v %v", ctx, tag)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// GetByURLAfterCounter returns a count of finished TagRepositoryMock.GetByURL invocations
|
|
|
-func (mmGetByURL *TagRepositoryMock) GetByURLAfterCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmGetByURL.afterGetByURLCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// GetByURLBeforeCounter returns a count of TagRepositoryMock.GetByURL invocations
|
|
|
-func (mmGetByURL *TagRepositoryMock) GetByURLBeforeCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmGetByURL.beforeGetByURLCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// Calls returns a list of arguments used in each call to TagRepositoryMock.GetByURL.
|
|
|
-// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
-func (mmGetByURL *mTagRepositoryMockGetByURL) Calls() []*TagRepositoryMockGetByURLParams {
|
|
|
- mmGetByURL.mutex.RLock()
|
|
|
-
|
|
|
- argCopy := make([]*TagRepositoryMockGetByURLParams, len(mmGetByURL.callArgs))
|
|
|
- copy(argCopy, mmGetByURL.callArgs)
|
|
|
-
|
|
|
- mmGetByURL.mutex.RUnlock()
|
|
|
-
|
|
|
- return argCopy
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockGetByURLDone returns true if the count of the GetByURL invocations corresponds
|
|
|
-// the number of defined expectations
|
|
|
-func (m *TagRepositoryMock) MinimockGetByURLDone() bool {
|
|
|
- for _, e := range m.GetByURLMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.GetByURLMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByURLCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcGetByURL != nil && mm_atomic.LoadUint64(&m.afterGetByURLCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockGetByURLInspect logs each unmet expectation
|
|
|
-func (m *TagRepositoryMock) MinimockGetByURLInspect() {
|
|
|
- for _, e := range m.GetByURLMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.GetByURL with params: %#v", *e.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.GetByURLMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetByURLCounter) < 1 {
|
|
|
- if m.GetByURLMock.defaultExpectation.params == nil {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.GetByURL")
|
|
|
- } else {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.GetByURL with params: %#v", *m.GetByURLMock.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcGetByURL != nil && mm_atomic.LoadUint64(&m.afterGetByURLCounter) < 1 {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.GetByURL")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-type mTagRepositoryMockIsUsed struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- defaultExpectation *TagRepositoryMockIsUsedExpectation
|
|
|
- expectations []*TagRepositoryMockIsUsedExpectation
|
|
|
-
|
|
|
- callArgs []*TagRepositoryMockIsUsedParams
|
|
|
- mutex sync.RWMutex
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockIsUsedExpectation specifies expectation struct of the TagRepository.IsUsed
|
|
|
-type TagRepositoryMockIsUsedExpectation struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- params *TagRepositoryMockIsUsedParams
|
|
|
- results *TagRepositoryMockIsUsedResults
|
|
|
- Counter uint64
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockIsUsedParams contains parameters of the TagRepository.IsUsed
|
|
|
-type TagRepositoryMockIsUsedParams struct {
|
|
|
- ctx context.Context
|
|
|
- ID int
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockIsUsedResults contains results of the TagRepository.IsUsed
|
|
|
-type TagRepositoryMockIsUsedResults struct {
|
|
|
- b1 bool
|
|
|
- err error
|
|
|
-}
|
|
|
-
|
|
|
-// Expect sets up expected params for TagRepository.IsUsed
|
|
|
-func (mmIsUsed *mTagRepositoryMockIsUsed) Expect(ctx context.Context, ID int) *mTagRepositoryMockIsUsed {
|
|
|
- if mmIsUsed.mock.funcIsUsed != nil {
|
|
|
- mmIsUsed.mock.t.Fatalf("TagRepositoryMock.IsUsed mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmIsUsed.defaultExpectation == nil {
|
|
|
- mmIsUsed.defaultExpectation = &TagRepositoryMockIsUsedExpectation{}
|
|
|
- }
|
|
|
-
|
|
|
- mmIsUsed.defaultExpectation.params = &TagRepositoryMockIsUsedParams{ctx, ID}
|
|
|
- for _, e := range mmIsUsed.expectations {
|
|
|
- if minimock.Equal(e.params, mmIsUsed.defaultExpectation.params) {
|
|
|
- mmIsUsed.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmIsUsed.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return mmIsUsed
|
|
|
-}
|
|
|
-
|
|
|
-// Inspect accepts an inspector function that has same arguments as the TagRepository.IsUsed
|
|
|
-func (mmIsUsed *mTagRepositoryMockIsUsed) Inspect(f func(ctx context.Context, ID int)) *mTagRepositoryMockIsUsed {
|
|
|
- if mmIsUsed.mock.inspectFuncIsUsed != nil {
|
|
|
- mmIsUsed.mock.t.Fatalf("Inspect function is already set for TagRepositoryMock.IsUsed")
|
|
|
- }
|
|
|
-
|
|
|
- mmIsUsed.mock.inspectFuncIsUsed = f
|
|
|
-
|
|
|
- return mmIsUsed
|
|
|
-}
|
|
|
-
|
|
|
-// Return sets up results that will be returned by TagRepository.IsUsed
|
|
|
-func (mmIsUsed *mTagRepositoryMockIsUsed) Return(b1 bool, err error) *TagRepositoryMock {
|
|
|
- if mmIsUsed.mock.funcIsUsed != nil {
|
|
|
- mmIsUsed.mock.t.Fatalf("TagRepositoryMock.IsUsed mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmIsUsed.defaultExpectation == nil {
|
|
|
- mmIsUsed.defaultExpectation = &TagRepositoryMockIsUsedExpectation{mock: mmIsUsed.mock}
|
|
|
- }
|
|
|
- mmIsUsed.defaultExpectation.results = &TagRepositoryMockIsUsedResults{b1, err}
|
|
|
- return mmIsUsed.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Set uses given function f to mock the TagRepository.IsUsed method
|
|
|
-func (mmIsUsed *mTagRepositoryMockIsUsed) Set(f func(ctx context.Context, ID int) (b1 bool, err error)) *TagRepositoryMock {
|
|
|
- if mmIsUsed.defaultExpectation != nil {
|
|
|
- mmIsUsed.mock.t.Fatalf("Default expectation is already set for the TagRepository.IsUsed method")
|
|
|
- }
|
|
|
-
|
|
|
- if len(mmIsUsed.expectations) > 0 {
|
|
|
- mmIsUsed.mock.t.Fatalf("Some expectations are already set for the TagRepository.IsUsed method")
|
|
|
- }
|
|
|
-
|
|
|
- mmIsUsed.mock.funcIsUsed = f
|
|
|
- return mmIsUsed.mock
|
|
|
-}
|
|
|
-
|
|
|
-// When sets expectation for the TagRepository.IsUsed which will trigger the result defined by the following
|
|
|
-// Then helper
|
|
|
-func (mmIsUsed *mTagRepositoryMockIsUsed) When(ctx context.Context, ID int) *TagRepositoryMockIsUsedExpectation {
|
|
|
- if mmIsUsed.mock.funcIsUsed != nil {
|
|
|
- mmIsUsed.mock.t.Fatalf("TagRepositoryMock.IsUsed mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- expectation := &TagRepositoryMockIsUsedExpectation{
|
|
|
- mock: mmIsUsed.mock,
|
|
|
- params: &TagRepositoryMockIsUsedParams{ctx, ID},
|
|
|
- }
|
|
|
- mmIsUsed.expectations = append(mmIsUsed.expectations, expectation)
|
|
|
- return expectation
|
|
|
-}
|
|
|
-
|
|
|
-// Then sets up TagRepository.IsUsed return parameters for the expectation previously defined by the When method
|
|
|
-func (e *TagRepositoryMockIsUsedExpectation) Then(b1 bool, err error) *TagRepositoryMock {
|
|
|
- e.results = &TagRepositoryMockIsUsedResults{b1, err}
|
|
|
- return e.mock
|
|
|
-}
|
|
|
-
|
|
|
-// IsUsed implements interfaces.TagRepository
|
|
|
-func (mmIsUsed *TagRepositoryMock) IsUsed(ctx context.Context, ID int) (b1 bool, err error) {
|
|
|
- mm_atomic.AddUint64(&mmIsUsed.beforeIsUsedCounter, 1)
|
|
|
- defer mm_atomic.AddUint64(&mmIsUsed.afterIsUsedCounter, 1)
|
|
|
-
|
|
|
- if mmIsUsed.inspectFuncIsUsed != nil {
|
|
|
- mmIsUsed.inspectFuncIsUsed(ctx, ID)
|
|
|
- }
|
|
|
-
|
|
|
- mm_params := &TagRepositoryMockIsUsedParams{ctx, ID}
|
|
|
-
|
|
|
- // Record call args
|
|
|
- mmIsUsed.IsUsedMock.mutex.Lock()
|
|
|
- mmIsUsed.IsUsedMock.callArgs = append(mmIsUsed.IsUsedMock.callArgs, mm_params)
|
|
|
- mmIsUsed.IsUsedMock.mutex.Unlock()
|
|
|
-
|
|
|
- for _, e := range mmIsUsed.IsUsedMock.expectations {
|
|
|
- if minimock.Equal(e.params, mm_params) {
|
|
|
- mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
- return e.results.b1, e.results.err
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if mmIsUsed.IsUsedMock.defaultExpectation != nil {
|
|
|
- mm_atomic.AddUint64(&mmIsUsed.IsUsedMock.defaultExpectation.Counter, 1)
|
|
|
- mm_want := mmIsUsed.IsUsedMock.defaultExpectation.params
|
|
|
- mm_got := TagRepositoryMockIsUsedParams{ctx, ID}
|
|
|
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
- mmIsUsed.t.Errorf("TagRepositoryMock.IsUsed got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
- }
|
|
|
-
|
|
|
- mm_results := mmIsUsed.IsUsedMock.defaultExpectation.results
|
|
|
- if mm_results == nil {
|
|
|
- mmIsUsed.t.Fatal("No results are set for the TagRepositoryMock.IsUsed")
|
|
|
- }
|
|
|
- return (*mm_results).b1, (*mm_results).err
|
|
|
- }
|
|
|
- if mmIsUsed.funcIsUsed != nil {
|
|
|
- return mmIsUsed.funcIsUsed(ctx, ID)
|
|
|
- }
|
|
|
- mmIsUsed.t.Fatalf("Unexpected call to TagRepositoryMock.IsUsed. %v %v", ctx, ID)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// IsUsedAfterCounter returns a count of finished TagRepositoryMock.IsUsed invocations
|
|
|
-func (mmIsUsed *TagRepositoryMock) IsUsedAfterCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmIsUsed.afterIsUsedCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// IsUsedBeforeCounter returns a count of TagRepositoryMock.IsUsed invocations
|
|
|
-func (mmIsUsed *TagRepositoryMock) IsUsedBeforeCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmIsUsed.beforeIsUsedCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// Calls returns a list of arguments used in each call to TagRepositoryMock.IsUsed.
|
|
|
-// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
-func (mmIsUsed *mTagRepositoryMockIsUsed) Calls() []*TagRepositoryMockIsUsedParams {
|
|
|
- mmIsUsed.mutex.RLock()
|
|
|
-
|
|
|
- argCopy := make([]*TagRepositoryMockIsUsedParams, len(mmIsUsed.callArgs))
|
|
|
- copy(argCopy, mmIsUsed.callArgs)
|
|
|
-
|
|
|
- mmIsUsed.mutex.RUnlock()
|
|
|
-
|
|
|
- return argCopy
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockIsUsedDone returns true if the count of the IsUsed invocations corresponds
|
|
|
-// the number of defined expectations
|
|
|
-func (m *TagRepositoryMock) MinimockIsUsedDone() bool {
|
|
|
- for _, e := range m.IsUsedMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.IsUsedMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterIsUsedCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcIsUsed != nil && mm_atomic.LoadUint64(&m.afterIsUsedCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockIsUsedInspect logs each unmet expectation
|
|
|
-func (m *TagRepositoryMock) MinimockIsUsedInspect() {
|
|
|
- for _, e := range m.IsUsedMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.IsUsed with params: %#v", *e.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.IsUsedMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterIsUsedCounter) < 1 {
|
|
|
- if m.IsUsedMock.defaultExpectation.params == nil {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.IsUsed")
|
|
|
- } else {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.IsUsed with params: %#v", *m.IsUsedMock.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcIsUsed != nil && mm_atomic.LoadUint64(&m.afterIsUsedCounter) < 1 {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.IsUsed")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-type mTagRepositoryMockUpdate struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- defaultExpectation *TagRepositoryMockUpdateExpectation
|
|
|
- expectations []*TagRepositoryMockUpdateExpectation
|
|
|
-
|
|
|
- callArgs []*TagRepositoryMockUpdateParams
|
|
|
- mutex sync.RWMutex
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockUpdateExpectation specifies expectation struct of the TagRepository.Update
|
|
|
-type TagRepositoryMockUpdateExpectation struct {
|
|
|
- mock *TagRepositoryMock
|
|
|
- params *TagRepositoryMockUpdateParams
|
|
|
- results *TagRepositoryMockUpdateResults
|
|
|
- Counter uint64
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockUpdateParams contains parameters of the TagRepository.Update
|
|
|
-type TagRepositoryMockUpdateParams struct {
|
|
|
- ctx context.Context
|
|
|
- m models.Tag
|
|
|
-}
|
|
|
-
|
|
|
-// TagRepositoryMockUpdateResults contains results of the TagRepository.Update
|
|
|
-type TagRepositoryMockUpdateResults struct {
|
|
|
- err error
|
|
|
-}
|
|
|
-
|
|
|
-// Expect sets up expected params for TagRepository.Update
|
|
|
-func (mmUpdate *mTagRepositoryMockUpdate) Expect(ctx context.Context, m models.Tag) *mTagRepositoryMockUpdate {
|
|
|
- if mmUpdate.mock.funcUpdate != nil {
|
|
|
- mmUpdate.mock.t.Fatalf("TagRepositoryMock.Update mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmUpdate.defaultExpectation == nil {
|
|
|
- mmUpdate.defaultExpectation = &TagRepositoryMockUpdateExpectation{}
|
|
|
- }
|
|
|
-
|
|
|
- mmUpdate.defaultExpectation.params = &TagRepositoryMockUpdateParams{ctx, m}
|
|
|
- for _, e := range mmUpdate.expectations {
|
|
|
- if minimock.Equal(e.params, mmUpdate.defaultExpectation.params) {
|
|
|
- mmUpdate.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdate.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return mmUpdate
|
|
|
-}
|
|
|
-
|
|
|
-// Inspect accepts an inspector function that has same arguments as the TagRepository.Update
|
|
|
-func (mmUpdate *mTagRepositoryMockUpdate) Inspect(f func(ctx context.Context, m models.Tag)) *mTagRepositoryMockUpdate {
|
|
|
- if mmUpdate.mock.inspectFuncUpdate != nil {
|
|
|
- mmUpdate.mock.t.Fatalf("Inspect function is already set for TagRepositoryMock.Update")
|
|
|
- }
|
|
|
-
|
|
|
- mmUpdate.mock.inspectFuncUpdate = f
|
|
|
-
|
|
|
- return mmUpdate
|
|
|
-}
|
|
|
-
|
|
|
-// Return sets up results that will be returned by TagRepository.Update
|
|
|
-func (mmUpdate *mTagRepositoryMockUpdate) Return(err error) *TagRepositoryMock {
|
|
|
- if mmUpdate.mock.funcUpdate != nil {
|
|
|
- mmUpdate.mock.t.Fatalf("TagRepositoryMock.Update mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- if mmUpdate.defaultExpectation == nil {
|
|
|
- mmUpdate.defaultExpectation = &TagRepositoryMockUpdateExpectation{mock: mmUpdate.mock}
|
|
|
- }
|
|
|
- mmUpdate.defaultExpectation.results = &TagRepositoryMockUpdateResults{err}
|
|
|
- return mmUpdate.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Set uses given function f to mock the TagRepository.Update method
|
|
|
-func (mmUpdate *mTagRepositoryMockUpdate) Set(f func(ctx context.Context, m models.Tag) (err error)) *TagRepositoryMock {
|
|
|
- if mmUpdate.defaultExpectation != nil {
|
|
|
- mmUpdate.mock.t.Fatalf("Default expectation is already set for the TagRepository.Update method")
|
|
|
- }
|
|
|
-
|
|
|
- if len(mmUpdate.expectations) > 0 {
|
|
|
- mmUpdate.mock.t.Fatalf("Some expectations are already set for the TagRepository.Update method")
|
|
|
- }
|
|
|
-
|
|
|
- mmUpdate.mock.funcUpdate = f
|
|
|
- return mmUpdate.mock
|
|
|
-}
|
|
|
-
|
|
|
-// When sets expectation for the TagRepository.Update which will trigger the result defined by the following
|
|
|
-// Then helper
|
|
|
-func (mmUpdate *mTagRepositoryMockUpdate) When(ctx context.Context, m models.Tag) *TagRepositoryMockUpdateExpectation {
|
|
|
- if mmUpdate.mock.funcUpdate != nil {
|
|
|
- mmUpdate.mock.t.Fatalf("TagRepositoryMock.Update mock is already set by Set")
|
|
|
- }
|
|
|
-
|
|
|
- expectation := &TagRepositoryMockUpdateExpectation{
|
|
|
- mock: mmUpdate.mock,
|
|
|
- params: &TagRepositoryMockUpdateParams{ctx, m},
|
|
|
- }
|
|
|
- mmUpdate.expectations = append(mmUpdate.expectations, expectation)
|
|
|
- return expectation
|
|
|
-}
|
|
|
-
|
|
|
-// Then sets up TagRepository.Update return parameters for the expectation previously defined by the When method
|
|
|
-func (e *TagRepositoryMockUpdateExpectation) Then(err error) *TagRepositoryMock {
|
|
|
- e.results = &TagRepositoryMockUpdateResults{err}
|
|
|
- return e.mock
|
|
|
-}
|
|
|
-
|
|
|
-// Update implements interfaces.TagRepository
|
|
|
-func (mmUpdate *TagRepositoryMock) Update(ctx context.Context, m models.Tag) (err error) {
|
|
|
- mm_atomic.AddUint64(&mmUpdate.beforeUpdateCounter, 1)
|
|
|
- defer mm_atomic.AddUint64(&mmUpdate.afterUpdateCounter, 1)
|
|
|
-
|
|
|
- if mmUpdate.inspectFuncUpdate != nil {
|
|
|
- mmUpdate.inspectFuncUpdate(ctx, m)
|
|
|
- }
|
|
|
-
|
|
|
- mm_params := &TagRepositoryMockUpdateParams{ctx, m}
|
|
|
-
|
|
|
- // Record call args
|
|
|
- mmUpdate.UpdateMock.mutex.Lock()
|
|
|
- mmUpdate.UpdateMock.callArgs = append(mmUpdate.UpdateMock.callArgs, mm_params)
|
|
|
- mmUpdate.UpdateMock.mutex.Unlock()
|
|
|
-
|
|
|
- for _, e := range mmUpdate.UpdateMock.expectations {
|
|
|
- if minimock.Equal(e.params, mm_params) {
|
|
|
- mm_atomic.AddUint64(&e.Counter, 1)
|
|
|
- return e.results.err
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if mmUpdate.UpdateMock.defaultExpectation != nil {
|
|
|
- mm_atomic.AddUint64(&mmUpdate.UpdateMock.defaultExpectation.Counter, 1)
|
|
|
- mm_want := mmUpdate.UpdateMock.defaultExpectation.params
|
|
|
- mm_got := TagRepositoryMockUpdateParams{ctx, m}
|
|
|
- if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
|
|
- mmUpdate.t.Errorf("TagRepositoryMock.Update got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
|
|
- }
|
|
|
-
|
|
|
- mm_results := mmUpdate.UpdateMock.defaultExpectation.results
|
|
|
- if mm_results == nil {
|
|
|
- mmUpdate.t.Fatal("No results are set for the TagRepositoryMock.Update")
|
|
|
- }
|
|
|
- return (*mm_results).err
|
|
|
- }
|
|
|
- if mmUpdate.funcUpdate != nil {
|
|
|
- return mmUpdate.funcUpdate(ctx, m)
|
|
|
- }
|
|
|
- mmUpdate.t.Fatalf("Unexpected call to TagRepositoryMock.Update. %v %v", ctx, m)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// UpdateAfterCounter returns a count of finished TagRepositoryMock.Update invocations
|
|
|
-func (mmUpdate *TagRepositoryMock) UpdateAfterCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmUpdate.afterUpdateCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// UpdateBeforeCounter returns a count of TagRepositoryMock.Update invocations
|
|
|
-func (mmUpdate *TagRepositoryMock) UpdateBeforeCounter() uint64 {
|
|
|
- return mm_atomic.LoadUint64(&mmUpdate.beforeUpdateCounter)
|
|
|
-}
|
|
|
-
|
|
|
-// Calls returns a list of arguments used in each call to TagRepositoryMock.Update.
|
|
|
-// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
|
|
-func (mmUpdate *mTagRepositoryMockUpdate) Calls() []*TagRepositoryMockUpdateParams {
|
|
|
- mmUpdate.mutex.RLock()
|
|
|
-
|
|
|
- argCopy := make([]*TagRepositoryMockUpdateParams, len(mmUpdate.callArgs))
|
|
|
- copy(argCopy, mmUpdate.callArgs)
|
|
|
-
|
|
|
- mmUpdate.mutex.RUnlock()
|
|
|
-
|
|
|
- return argCopy
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockUpdateDone returns true if the count of the Update invocations corresponds
|
|
|
-// the number of defined expectations
|
|
|
-func (m *TagRepositoryMock) MinimockUpdateDone() bool {
|
|
|
- for _, e := range m.UpdateMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.UpdateMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterUpdateCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcUpdate != nil && mm_atomic.LoadUint64(&m.afterUpdateCounter) < 1 {
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockUpdateInspect logs each unmet expectation
|
|
|
-func (m *TagRepositoryMock) MinimockUpdateInspect() {
|
|
|
- for _, e := range m.UpdateMock.expectations {
|
|
|
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.Update with params: %#v", *e.params)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // if default expectation was set then invocations count should be greater than zero
|
|
|
- if m.UpdateMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterUpdateCounter) < 1 {
|
|
|
- if m.UpdateMock.defaultExpectation.params == nil {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.Update")
|
|
|
- } else {
|
|
|
- m.t.Errorf("Expected call to TagRepositoryMock.Update with params: %#v", *m.UpdateMock.defaultExpectation.params)
|
|
|
- }
|
|
|
- }
|
|
|
- // if func was set then invocations count should be greater than zero
|
|
|
- if m.funcUpdate != nil && mm_atomic.LoadUint64(&m.afterUpdateCounter) < 1 {
|
|
|
- m.t.Error("Expected call to TagRepositoryMock.Update")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockFinish checks that all mocked methods have been called the expected number of times
|
|
|
-func (m *TagRepositoryMock) MinimockFinish() {
|
|
|
- if !m.minimockDone() {
|
|
|
- m.MinimockAddInspect()
|
|
|
-
|
|
|
- m.MinimockDeleteInspect()
|
|
|
-
|
|
|
- m.MinimockGetAllInspect()
|
|
|
-
|
|
|
- m.MinimockGetAllUsedInspect()
|
|
|
-
|
|
|
- m.MinimockGetByArticleIDInspect()
|
|
|
-
|
|
|
- m.MinimockGetByIDInspect()
|
|
|
-
|
|
|
- m.MinimockGetByURLInspect()
|
|
|
-
|
|
|
- m.MinimockIsUsedInspect()
|
|
|
-
|
|
|
- m.MinimockUpdateInspect()
|
|
|
- m.t.FailNow()
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// MinimockWait waits for all mocked methods to be called the expected number of times
|
|
|
-func (m *TagRepositoryMock) MinimockWait(timeout mm_time.Duration) {
|
|
|
- timeoutCh := mm_time.After(timeout)
|
|
|
- for {
|
|
|
- if m.minimockDone() {
|
|
|
- return
|
|
|
- }
|
|
|
- select {
|
|
|
- case <-timeoutCh:
|
|
|
- m.MinimockFinish()
|
|
|
- return
|
|
|
- case <-mm_time.After(10 * mm_time.Millisecond):
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-func (m *TagRepositoryMock) minimockDone() bool {
|
|
|
- done := true
|
|
|
- return done &&
|
|
|
- m.MinimockAddDone() &&
|
|
|
- m.MinimockDeleteDone() &&
|
|
|
- m.MinimockGetAllDone() &&
|
|
|
- m.MinimockGetAllUsedDone() &&
|
|
|
- m.MinimockGetByArticleIDDone() &&
|
|
|
- m.MinimockGetByIDDone() &&
|
|
|
- m.MinimockGetByURLDone() &&
|
|
|
- m.MinimockIsUsedDone() &&
|
|
|
- m.MinimockUpdateDone()
|
|
|
-}
|