// Code generated by http://github.com/gojuno/minimock (v3.3.13). DO NOT EDIT. package mocks //go:generate minimock -i git.dmitriygnatenko.ru/dima/homethings/internal/api/v1/user.AuthService -o auth_service_minimock.go -n AuthServiceMock -p mocks import ( "sync" mm_atomic "sync/atomic" mm_time "time" "github.com/gofiber/fiber/v2" "github.com/gojuno/minimock/v3" "github.com/golang-jwt/jwt/v4" ) // AuthServiceMock implements user.AuthService type AuthServiceMock struct { t minimock.Tester finishOnce sync.Once funcGeneratePasswordHash func(password string) (s1 string, err error) inspectFuncGeneratePasswordHash func(password string) afterGeneratePasswordHashCounter uint64 beforeGeneratePasswordHashCounter uint64 GeneratePasswordHashMock mAuthServiceMockGeneratePasswordHash funcGetClaims func(fctx *fiber.Ctx) (m1 jwt.MapClaims) inspectFuncGetClaims func(fctx *fiber.Ctx) afterGetClaimsCounter uint64 beforeGetClaimsCounter uint64 GetClaimsMock mAuthServiceMockGetClaims } // NewAuthServiceMock returns a mock for user.AuthService func NewAuthServiceMock(t minimock.Tester) *AuthServiceMock { m := &AuthServiceMock{t: t} if controller, ok := t.(minimock.MockController); ok { controller.RegisterMocker(m) } m.GeneratePasswordHashMock = mAuthServiceMockGeneratePasswordHash{mock: m} m.GeneratePasswordHashMock.callArgs = []*AuthServiceMockGeneratePasswordHashParams{} m.GetClaimsMock = mAuthServiceMockGetClaims{mock: m} m.GetClaimsMock.callArgs = []*AuthServiceMockGetClaimsParams{} t.Cleanup(m.MinimockFinish) return m } type mAuthServiceMockGeneratePasswordHash struct { optional bool mock *AuthServiceMock defaultExpectation *AuthServiceMockGeneratePasswordHashExpectation expectations []*AuthServiceMockGeneratePasswordHashExpectation callArgs []*AuthServiceMockGeneratePasswordHashParams mutex sync.RWMutex expectedInvocations uint64 } // AuthServiceMockGeneratePasswordHashExpectation specifies expectation struct of the AuthService.GeneratePasswordHash type AuthServiceMockGeneratePasswordHashExpectation struct { mock *AuthServiceMock params *AuthServiceMockGeneratePasswordHashParams paramPtrs *AuthServiceMockGeneratePasswordHashParamPtrs results *AuthServiceMockGeneratePasswordHashResults Counter uint64 } // AuthServiceMockGeneratePasswordHashParams contains parameters of the AuthService.GeneratePasswordHash type AuthServiceMockGeneratePasswordHashParams struct { password string } // AuthServiceMockGeneratePasswordHashParamPtrs contains pointers to parameters of the AuthService.GeneratePasswordHash type AuthServiceMockGeneratePasswordHashParamPtrs struct { password *string } // AuthServiceMockGeneratePasswordHashResults contains results of the AuthService.GeneratePasswordHash type AuthServiceMockGeneratePasswordHashResults struct { s1 string err error } // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. // It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to // catch the problems when the expected method call is totally skipped during test run. func (mmGeneratePasswordHash *mAuthServiceMockGeneratePasswordHash) Optional() *mAuthServiceMockGeneratePasswordHash { mmGeneratePasswordHash.optional = true return mmGeneratePasswordHash } // Expect sets up expected params for AuthService.GeneratePasswordHash func (mmGeneratePasswordHash *mAuthServiceMockGeneratePasswordHash) Expect(password string) *mAuthServiceMockGeneratePasswordHash { if mmGeneratePasswordHash.mock.funcGeneratePasswordHash != nil { mmGeneratePasswordHash.mock.t.Fatalf("AuthServiceMock.GeneratePasswordHash mock is already set by Set") } if mmGeneratePasswordHash.defaultExpectation == nil { mmGeneratePasswordHash.defaultExpectation = &AuthServiceMockGeneratePasswordHashExpectation{} } if mmGeneratePasswordHash.defaultExpectation.paramPtrs != nil { mmGeneratePasswordHash.mock.t.Fatalf("AuthServiceMock.GeneratePasswordHash mock is already set by ExpectParams functions") } mmGeneratePasswordHash.defaultExpectation.params = &AuthServiceMockGeneratePasswordHashParams{password} for _, e := range mmGeneratePasswordHash.expectations { if minimock.Equal(e.params, mmGeneratePasswordHash.defaultExpectation.params) { mmGeneratePasswordHash.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGeneratePasswordHash.defaultExpectation.params) } } return mmGeneratePasswordHash } // ExpectPasswordParam1 sets up expected param password for AuthService.GeneratePasswordHash func (mmGeneratePasswordHash *mAuthServiceMockGeneratePasswordHash) ExpectPasswordParam1(password string) *mAuthServiceMockGeneratePasswordHash { if mmGeneratePasswordHash.mock.funcGeneratePasswordHash != nil { mmGeneratePasswordHash.mock.t.Fatalf("AuthServiceMock.GeneratePasswordHash mock is already set by Set") } if mmGeneratePasswordHash.defaultExpectation == nil { mmGeneratePasswordHash.defaultExpectation = &AuthServiceMockGeneratePasswordHashExpectation{} } if mmGeneratePasswordHash.defaultExpectation.params != nil { mmGeneratePasswordHash.mock.t.Fatalf("AuthServiceMock.GeneratePasswordHash mock is already set by Expect") } if mmGeneratePasswordHash.defaultExpectation.paramPtrs == nil { mmGeneratePasswordHash.defaultExpectation.paramPtrs = &AuthServiceMockGeneratePasswordHashParamPtrs{} } mmGeneratePasswordHash.defaultExpectation.paramPtrs.password = &password return mmGeneratePasswordHash } // Inspect accepts an inspector function that has same arguments as the AuthService.GeneratePasswordHash func (mmGeneratePasswordHash *mAuthServiceMockGeneratePasswordHash) Inspect(f func(password string)) *mAuthServiceMockGeneratePasswordHash { if mmGeneratePasswordHash.mock.inspectFuncGeneratePasswordHash != nil { mmGeneratePasswordHash.mock.t.Fatalf("Inspect function is already set for AuthServiceMock.GeneratePasswordHash") } mmGeneratePasswordHash.mock.inspectFuncGeneratePasswordHash = f return mmGeneratePasswordHash } // Return sets up results that will be returned by AuthService.GeneratePasswordHash func (mmGeneratePasswordHash *mAuthServiceMockGeneratePasswordHash) Return(s1 string, err error) *AuthServiceMock { if mmGeneratePasswordHash.mock.funcGeneratePasswordHash != nil { mmGeneratePasswordHash.mock.t.Fatalf("AuthServiceMock.GeneratePasswordHash mock is already set by Set") } if mmGeneratePasswordHash.defaultExpectation == nil { mmGeneratePasswordHash.defaultExpectation = &AuthServiceMockGeneratePasswordHashExpectation{mock: mmGeneratePasswordHash.mock} } mmGeneratePasswordHash.defaultExpectation.results = &AuthServiceMockGeneratePasswordHashResults{s1, err} return mmGeneratePasswordHash.mock } // Set uses given function f to mock the AuthService.GeneratePasswordHash method func (mmGeneratePasswordHash *mAuthServiceMockGeneratePasswordHash) Set(f func(password string) (s1 string, err error)) *AuthServiceMock { if mmGeneratePasswordHash.defaultExpectation != nil { mmGeneratePasswordHash.mock.t.Fatalf("Default expectation is already set for the AuthService.GeneratePasswordHash method") } if len(mmGeneratePasswordHash.expectations) > 0 { mmGeneratePasswordHash.mock.t.Fatalf("Some expectations are already set for the AuthService.GeneratePasswordHash method") } mmGeneratePasswordHash.mock.funcGeneratePasswordHash = f return mmGeneratePasswordHash.mock } // When sets expectation for the AuthService.GeneratePasswordHash which will trigger the result defined by the following // Then helper func (mmGeneratePasswordHash *mAuthServiceMockGeneratePasswordHash) When(password string) *AuthServiceMockGeneratePasswordHashExpectation { if mmGeneratePasswordHash.mock.funcGeneratePasswordHash != nil { mmGeneratePasswordHash.mock.t.Fatalf("AuthServiceMock.GeneratePasswordHash mock is already set by Set") } expectation := &AuthServiceMockGeneratePasswordHashExpectation{ mock: mmGeneratePasswordHash.mock, params: &AuthServiceMockGeneratePasswordHashParams{password}, } mmGeneratePasswordHash.expectations = append(mmGeneratePasswordHash.expectations, expectation) return expectation } // Then sets up AuthService.GeneratePasswordHash return parameters for the expectation previously defined by the When method func (e *AuthServiceMockGeneratePasswordHashExpectation) Then(s1 string, err error) *AuthServiceMock { e.results = &AuthServiceMockGeneratePasswordHashResults{s1, err} return e.mock } // Times sets number of times AuthService.GeneratePasswordHash should be invoked func (mmGeneratePasswordHash *mAuthServiceMockGeneratePasswordHash) Times(n uint64) *mAuthServiceMockGeneratePasswordHash { if n == 0 { mmGeneratePasswordHash.mock.t.Fatalf("Times of AuthServiceMock.GeneratePasswordHash mock can not be zero") } mm_atomic.StoreUint64(&mmGeneratePasswordHash.expectedInvocations, n) return mmGeneratePasswordHash } func (mmGeneratePasswordHash *mAuthServiceMockGeneratePasswordHash) invocationsDone() bool { if len(mmGeneratePasswordHash.expectations) == 0 && mmGeneratePasswordHash.defaultExpectation == nil && mmGeneratePasswordHash.mock.funcGeneratePasswordHash == nil { return true } totalInvocations := mm_atomic.LoadUint64(&mmGeneratePasswordHash.mock.afterGeneratePasswordHashCounter) expectedInvocations := mm_atomic.LoadUint64(&mmGeneratePasswordHash.expectedInvocations) return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } // GeneratePasswordHash implements user.AuthService func (mmGeneratePasswordHash *AuthServiceMock) GeneratePasswordHash(password string) (s1 string, err error) { mm_atomic.AddUint64(&mmGeneratePasswordHash.beforeGeneratePasswordHashCounter, 1) defer mm_atomic.AddUint64(&mmGeneratePasswordHash.afterGeneratePasswordHashCounter, 1) if mmGeneratePasswordHash.inspectFuncGeneratePasswordHash != nil { mmGeneratePasswordHash.inspectFuncGeneratePasswordHash(password) } mm_params := AuthServiceMockGeneratePasswordHashParams{password} // Record call args mmGeneratePasswordHash.GeneratePasswordHashMock.mutex.Lock() mmGeneratePasswordHash.GeneratePasswordHashMock.callArgs = append(mmGeneratePasswordHash.GeneratePasswordHashMock.callArgs, &mm_params) mmGeneratePasswordHash.GeneratePasswordHashMock.mutex.Unlock() for _, e := range mmGeneratePasswordHash.GeneratePasswordHashMock.expectations { if minimock.Equal(*e.params, mm_params) { mm_atomic.AddUint64(&e.Counter, 1) return e.results.s1, e.results.err } } if mmGeneratePasswordHash.GeneratePasswordHashMock.defaultExpectation != nil { mm_atomic.AddUint64(&mmGeneratePasswordHash.GeneratePasswordHashMock.defaultExpectation.Counter, 1) mm_want := mmGeneratePasswordHash.GeneratePasswordHashMock.defaultExpectation.params mm_want_ptrs := mmGeneratePasswordHash.GeneratePasswordHashMock.defaultExpectation.paramPtrs mm_got := AuthServiceMockGeneratePasswordHashParams{password} if mm_want_ptrs != nil { if mm_want_ptrs.password != nil && !minimock.Equal(*mm_want_ptrs.password, mm_got.password) { mmGeneratePasswordHash.t.Errorf("AuthServiceMock.GeneratePasswordHash got unexpected parameter password, want: %#v, got: %#v%s\n", *mm_want_ptrs.password, mm_got.password, minimock.Diff(*mm_want_ptrs.password, mm_got.password)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { mmGeneratePasswordHash.t.Errorf("AuthServiceMock.GeneratePasswordHash got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGeneratePasswordHash.GeneratePasswordHashMock.defaultExpectation.results if mm_results == nil { mmGeneratePasswordHash.t.Fatal("No results are set for the AuthServiceMock.GeneratePasswordHash") } return (*mm_results).s1, (*mm_results).err } if mmGeneratePasswordHash.funcGeneratePasswordHash != nil { return mmGeneratePasswordHash.funcGeneratePasswordHash(password) } mmGeneratePasswordHash.t.Fatalf("Unexpected call to AuthServiceMock.GeneratePasswordHash. %v", password) return } // GeneratePasswordHashAfterCounter returns a count of finished AuthServiceMock.GeneratePasswordHash invocations func (mmGeneratePasswordHash *AuthServiceMock) GeneratePasswordHashAfterCounter() uint64 { return mm_atomic.LoadUint64(&mmGeneratePasswordHash.afterGeneratePasswordHashCounter) } // GeneratePasswordHashBeforeCounter returns a count of AuthServiceMock.GeneratePasswordHash invocations func (mmGeneratePasswordHash *AuthServiceMock) GeneratePasswordHashBeforeCounter() uint64 { return mm_atomic.LoadUint64(&mmGeneratePasswordHash.beforeGeneratePasswordHashCounter) } // Calls returns a list of arguments used in each call to AuthServiceMock.GeneratePasswordHash. // The list is in the same order as the calls were made (i.e. recent calls have a higher index) func (mmGeneratePasswordHash *mAuthServiceMockGeneratePasswordHash) Calls() []*AuthServiceMockGeneratePasswordHashParams { mmGeneratePasswordHash.mutex.RLock() argCopy := make([]*AuthServiceMockGeneratePasswordHashParams, len(mmGeneratePasswordHash.callArgs)) copy(argCopy, mmGeneratePasswordHash.callArgs) mmGeneratePasswordHash.mutex.RUnlock() return argCopy } // MinimockGeneratePasswordHashDone returns true if the count of the GeneratePasswordHash invocations corresponds // the number of defined expectations func (m *AuthServiceMock) MinimockGeneratePasswordHashDone() bool { if m.GeneratePasswordHashMock.optional { // Optional methods provide '0 or more' call count restriction. return true } for _, e := range m.GeneratePasswordHashMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { return false } } return m.GeneratePasswordHashMock.invocationsDone() } // MinimockGeneratePasswordHashInspect logs each unmet expectation func (m *AuthServiceMock) MinimockGeneratePasswordHashInspect() { for _, e := range m.GeneratePasswordHashMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { m.t.Errorf("Expected call to AuthServiceMock.GeneratePasswordHash with params: %#v", *e.params) } } afterGeneratePasswordHashCounter := mm_atomic.LoadUint64(&m.afterGeneratePasswordHashCounter) // if default expectation was set then invocations count should be greater than zero if m.GeneratePasswordHashMock.defaultExpectation != nil && afterGeneratePasswordHashCounter < 1 { if m.GeneratePasswordHashMock.defaultExpectation.params == nil { m.t.Error("Expected call to AuthServiceMock.GeneratePasswordHash") } else { m.t.Errorf("Expected call to AuthServiceMock.GeneratePasswordHash with params: %#v", *m.GeneratePasswordHashMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGeneratePasswordHash != nil && afterGeneratePasswordHashCounter < 1 { m.t.Error("Expected call to AuthServiceMock.GeneratePasswordHash") } if !m.GeneratePasswordHashMock.invocationsDone() && afterGeneratePasswordHashCounter > 0 { m.t.Errorf("Expected %d calls to AuthServiceMock.GeneratePasswordHash but found %d calls", mm_atomic.LoadUint64(&m.GeneratePasswordHashMock.expectedInvocations), afterGeneratePasswordHashCounter) } } type mAuthServiceMockGetClaims struct { optional bool mock *AuthServiceMock defaultExpectation *AuthServiceMockGetClaimsExpectation expectations []*AuthServiceMockGetClaimsExpectation callArgs []*AuthServiceMockGetClaimsParams mutex sync.RWMutex expectedInvocations uint64 } // AuthServiceMockGetClaimsExpectation specifies expectation struct of the AuthService.GetClaims type AuthServiceMockGetClaimsExpectation struct { mock *AuthServiceMock params *AuthServiceMockGetClaimsParams paramPtrs *AuthServiceMockGetClaimsParamPtrs results *AuthServiceMockGetClaimsResults Counter uint64 } // AuthServiceMockGetClaimsParams contains parameters of the AuthService.GetClaims type AuthServiceMockGetClaimsParams struct { fctx *fiber.Ctx } // AuthServiceMockGetClaimsParamPtrs contains pointers to parameters of the AuthService.GetClaims type AuthServiceMockGetClaimsParamPtrs struct { fctx **fiber.Ctx } // AuthServiceMockGetClaimsResults contains results of the AuthService.GetClaims type AuthServiceMockGetClaimsResults struct { m1 jwt.MapClaims } // Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning // the test will fail minimock's automatic final call check if the mocked method was not called at least once. // Optional() makes method check to work in '0 or more' mode. // It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to // catch the problems when the expected method call is totally skipped during test run. func (mmGetClaims *mAuthServiceMockGetClaims) Optional() *mAuthServiceMockGetClaims { mmGetClaims.optional = true return mmGetClaims } // Expect sets up expected params for AuthService.GetClaims func (mmGetClaims *mAuthServiceMockGetClaims) Expect(fctx *fiber.Ctx) *mAuthServiceMockGetClaims { if mmGetClaims.mock.funcGetClaims != nil { mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by Set") } if mmGetClaims.defaultExpectation == nil { mmGetClaims.defaultExpectation = &AuthServiceMockGetClaimsExpectation{} } if mmGetClaims.defaultExpectation.paramPtrs != nil { mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by ExpectParams functions") } mmGetClaims.defaultExpectation.params = &AuthServiceMockGetClaimsParams{fctx} for _, e := range mmGetClaims.expectations { if minimock.Equal(e.params, mmGetClaims.defaultExpectation.params) { mmGetClaims.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetClaims.defaultExpectation.params) } } return mmGetClaims } // ExpectFctxParam1 sets up expected param fctx for AuthService.GetClaims func (mmGetClaims *mAuthServiceMockGetClaims) ExpectFctxParam1(fctx *fiber.Ctx) *mAuthServiceMockGetClaims { if mmGetClaims.mock.funcGetClaims != nil { mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by Set") } if mmGetClaims.defaultExpectation == nil { mmGetClaims.defaultExpectation = &AuthServiceMockGetClaimsExpectation{} } if mmGetClaims.defaultExpectation.params != nil { mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by Expect") } if mmGetClaims.defaultExpectation.paramPtrs == nil { mmGetClaims.defaultExpectation.paramPtrs = &AuthServiceMockGetClaimsParamPtrs{} } mmGetClaims.defaultExpectation.paramPtrs.fctx = &fctx return mmGetClaims } // Inspect accepts an inspector function that has same arguments as the AuthService.GetClaims func (mmGetClaims *mAuthServiceMockGetClaims) Inspect(f func(fctx *fiber.Ctx)) *mAuthServiceMockGetClaims { if mmGetClaims.mock.inspectFuncGetClaims != nil { mmGetClaims.mock.t.Fatalf("Inspect function is already set for AuthServiceMock.GetClaims") } mmGetClaims.mock.inspectFuncGetClaims = f return mmGetClaims } // Return sets up results that will be returned by AuthService.GetClaims func (mmGetClaims *mAuthServiceMockGetClaims) Return(m1 jwt.MapClaims) *AuthServiceMock { if mmGetClaims.mock.funcGetClaims != nil { mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by Set") } if mmGetClaims.defaultExpectation == nil { mmGetClaims.defaultExpectation = &AuthServiceMockGetClaimsExpectation{mock: mmGetClaims.mock} } mmGetClaims.defaultExpectation.results = &AuthServiceMockGetClaimsResults{m1} return mmGetClaims.mock } // Set uses given function f to mock the AuthService.GetClaims method func (mmGetClaims *mAuthServiceMockGetClaims) Set(f func(fctx *fiber.Ctx) (m1 jwt.MapClaims)) *AuthServiceMock { if mmGetClaims.defaultExpectation != nil { mmGetClaims.mock.t.Fatalf("Default expectation is already set for the AuthService.GetClaims method") } if len(mmGetClaims.expectations) > 0 { mmGetClaims.mock.t.Fatalf("Some expectations are already set for the AuthService.GetClaims method") } mmGetClaims.mock.funcGetClaims = f return mmGetClaims.mock } // When sets expectation for the AuthService.GetClaims which will trigger the result defined by the following // Then helper func (mmGetClaims *mAuthServiceMockGetClaims) When(fctx *fiber.Ctx) *AuthServiceMockGetClaimsExpectation { if mmGetClaims.mock.funcGetClaims != nil { mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by Set") } expectation := &AuthServiceMockGetClaimsExpectation{ mock: mmGetClaims.mock, params: &AuthServiceMockGetClaimsParams{fctx}, } mmGetClaims.expectations = append(mmGetClaims.expectations, expectation) return expectation } // Then sets up AuthService.GetClaims return parameters for the expectation previously defined by the When method func (e *AuthServiceMockGetClaimsExpectation) Then(m1 jwt.MapClaims) *AuthServiceMock { e.results = &AuthServiceMockGetClaimsResults{m1} return e.mock } // Times sets number of times AuthService.GetClaims should be invoked func (mmGetClaims *mAuthServiceMockGetClaims) Times(n uint64) *mAuthServiceMockGetClaims { if n == 0 { mmGetClaims.mock.t.Fatalf("Times of AuthServiceMock.GetClaims mock can not be zero") } mm_atomic.StoreUint64(&mmGetClaims.expectedInvocations, n) return mmGetClaims } func (mmGetClaims *mAuthServiceMockGetClaims) invocationsDone() bool { if len(mmGetClaims.expectations) == 0 && mmGetClaims.defaultExpectation == nil && mmGetClaims.mock.funcGetClaims == nil { return true } totalInvocations := mm_atomic.LoadUint64(&mmGetClaims.mock.afterGetClaimsCounter) expectedInvocations := mm_atomic.LoadUint64(&mmGetClaims.expectedInvocations) return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations) } // GetClaims implements user.AuthService func (mmGetClaims *AuthServiceMock) GetClaims(fctx *fiber.Ctx) (m1 jwt.MapClaims) { mm_atomic.AddUint64(&mmGetClaims.beforeGetClaimsCounter, 1) defer mm_atomic.AddUint64(&mmGetClaims.afterGetClaimsCounter, 1) if mmGetClaims.inspectFuncGetClaims != nil { mmGetClaims.inspectFuncGetClaims(fctx) } mm_params := AuthServiceMockGetClaimsParams{fctx} // Record call args mmGetClaims.GetClaimsMock.mutex.Lock() mmGetClaims.GetClaimsMock.callArgs = append(mmGetClaims.GetClaimsMock.callArgs, &mm_params) mmGetClaims.GetClaimsMock.mutex.Unlock() for _, e := range mmGetClaims.GetClaimsMock.expectations { if minimock.Equal(*e.params, mm_params) { mm_atomic.AddUint64(&e.Counter, 1) return e.results.m1 } } if mmGetClaims.GetClaimsMock.defaultExpectation != nil { mm_atomic.AddUint64(&mmGetClaims.GetClaimsMock.defaultExpectation.Counter, 1) mm_want := mmGetClaims.GetClaimsMock.defaultExpectation.params mm_want_ptrs := mmGetClaims.GetClaimsMock.defaultExpectation.paramPtrs mm_got := AuthServiceMockGetClaimsParams{fctx} if mm_want_ptrs != nil { if mm_want_ptrs.fctx != nil && !minimock.Equal(*mm_want_ptrs.fctx, mm_got.fctx) { mmGetClaims.t.Errorf("AuthServiceMock.GetClaims got unexpected parameter fctx, want: %#v, got: %#v%s\n", *mm_want_ptrs.fctx, mm_got.fctx, minimock.Diff(*mm_want_ptrs.fctx, mm_got.fctx)) } } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) { mmGetClaims.t.Errorf("AuthServiceMock.GetClaims got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got)) } mm_results := mmGetClaims.GetClaimsMock.defaultExpectation.results if mm_results == nil { mmGetClaims.t.Fatal("No results are set for the AuthServiceMock.GetClaims") } return (*mm_results).m1 } if mmGetClaims.funcGetClaims != nil { return mmGetClaims.funcGetClaims(fctx) } mmGetClaims.t.Fatalf("Unexpected call to AuthServiceMock.GetClaims. %v", fctx) return } // GetClaimsAfterCounter returns a count of finished AuthServiceMock.GetClaims invocations func (mmGetClaims *AuthServiceMock) GetClaimsAfterCounter() uint64 { return mm_atomic.LoadUint64(&mmGetClaims.afterGetClaimsCounter) } // GetClaimsBeforeCounter returns a count of AuthServiceMock.GetClaims invocations func (mmGetClaims *AuthServiceMock) GetClaimsBeforeCounter() uint64 { return mm_atomic.LoadUint64(&mmGetClaims.beforeGetClaimsCounter) } // Calls returns a list of arguments used in each call to AuthServiceMock.GetClaims. // The list is in the same order as the calls were made (i.e. recent calls have a higher index) func (mmGetClaims *mAuthServiceMockGetClaims) Calls() []*AuthServiceMockGetClaimsParams { mmGetClaims.mutex.RLock() argCopy := make([]*AuthServiceMockGetClaimsParams, len(mmGetClaims.callArgs)) copy(argCopy, mmGetClaims.callArgs) mmGetClaims.mutex.RUnlock() return argCopy } // MinimockGetClaimsDone returns true if the count of the GetClaims invocations corresponds // the number of defined expectations func (m *AuthServiceMock) MinimockGetClaimsDone() bool { if m.GetClaimsMock.optional { // Optional methods provide '0 or more' call count restriction. return true } for _, e := range m.GetClaimsMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { return false } } return m.GetClaimsMock.invocationsDone() } // MinimockGetClaimsInspect logs each unmet expectation func (m *AuthServiceMock) MinimockGetClaimsInspect() { for _, e := range m.GetClaimsMock.expectations { if mm_atomic.LoadUint64(&e.Counter) < 1 { m.t.Errorf("Expected call to AuthServiceMock.GetClaims with params: %#v", *e.params) } } afterGetClaimsCounter := mm_atomic.LoadUint64(&m.afterGetClaimsCounter) // if default expectation was set then invocations count should be greater than zero if m.GetClaimsMock.defaultExpectation != nil && afterGetClaimsCounter < 1 { if m.GetClaimsMock.defaultExpectation.params == nil { m.t.Error("Expected call to AuthServiceMock.GetClaims") } else { m.t.Errorf("Expected call to AuthServiceMock.GetClaims with params: %#v", *m.GetClaimsMock.defaultExpectation.params) } } // if func was set then invocations count should be greater than zero if m.funcGetClaims != nil && afterGetClaimsCounter < 1 { m.t.Error("Expected call to AuthServiceMock.GetClaims") } if !m.GetClaimsMock.invocationsDone() && afterGetClaimsCounter > 0 { m.t.Errorf("Expected %d calls to AuthServiceMock.GetClaims but found %d calls", mm_atomic.LoadUint64(&m.GetClaimsMock.expectedInvocations), afterGetClaimsCounter) } } // MinimockFinish checks that all mocked methods have been called the expected number of times func (m *AuthServiceMock) MinimockFinish() { m.finishOnce.Do(func() { if !m.minimockDone() { m.MinimockGeneratePasswordHashInspect() m.MinimockGetClaimsInspect() } }) } // MinimockWait waits for all mocked methods to be called the expected number of times func (m *AuthServiceMock) 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 *AuthServiceMock) minimockDone() bool { done := true return done && m.MinimockGeneratePasswordHashDone() && m.MinimockGetClaimsDone() }