github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/requirements/requirementsfakes/fake_user_requirement.go (about) 1 // This file was generated by counterfeiter 2 package requirementsfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/models" 8 "code.cloudfoundry.org/cli/cf/requirements" 9 ) 10 11 type FakeUserRequirement struct { 12 ExecuteStub func() error 13 executeMutex sync.RWMutex 14 executeArgsForCall []struct{} 15 executeReturns struct { 16 result1 error 17 } 18 GetUserStub func() models.UserFields 19 getUserMutex sync.RWMutex 20 getUserArgsForCall []struct{} 21 getUserReturns struct { 22 result1 models.UserFields 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *FakeUserRequirement) Execute() error { 29 fake.executeMutex.Lock() 30 fake.executeArgsForCall = append(fake.executeArgsForCall, struct{}{}) 31 fake.recordInvocation("Execute", []interface{}{}) 32 fake.executeMutex.Unlock() 33 if fake.ExecuteStub != nil { 34 return fake.ExecuteStub() 35 } else { 36 return fake.executeReturns.result1 37 } 38 } 39 40 func (fake *FakeUserRequirement) ExecuteCallCount() int { 41 fake.executeMutex.RLock() 42 defer fake.executeMutex.RUnlock() 43 return len(fake.executeArgsForCall) 44 } 45 46 func (fake *FakeUserRequirement) ExecuteReturns(result1 error) { 47 fake.ExecuteStub = nil 48 fake.executeReturns = struct { 49 result1 error 50 }{result1} 51 } 52 53 func (fake *FakeUserRequirement) GetUser() models.UserFields { 54 fake.getUserMutex.Lock() 55 fake.getUserArgsForCall = append(fake.getUserArgsForCall, struct{}{}) 56 fake.recordInvocation("GetUser", []interface{}{}) 57 fake.getUserMutex.Unlock() 58 if fake.GetUserStub != nil { 59 return fake.GetUserStub() 60 } else { 61 return fake.getUserReturns.result1 62 } 63 } 64 65 func (fake *FakeUserRequirement) GetUserCallCount() int { 66 fake.getUserMutex.RLock() 67 defer fake.getUserMutex.RUnlock() 68 return len(fake.getUserArgsForCall) 69 } 70 71 func (fake *FakeUserRequirement) GetUserReturns(result1 models.UserFields) { 72 fake.GetUserStub = nil 73 fake.getUserReturns = struct { 74 result1 models.UserFields 75 }{result1} 76 } 77 78 func (fake *FakeUserRequirement) Invocations() map[string][][]interface{} { 79 fake.invocationsMutex.RLock() 80 defer fake.invocationsMutex.RUnlock() 81 fake.executeMutex.RLock() 82 defer fake.executeMutex.RUnlock() 83 fake.getUserMutex.RLock() 84 defer fake.getUserMutex.RUnlock() 85 return fake.invocations 86 } 87 88 func (fake *FakeUserRequirement) recordInvocation(key string, args []interface{}) { 89 fake.invocationsMutex.Lock() 90 defer fake.invocationsMutex.Unlock() 91 if fake.invocations == nil { 92 fake.invocations = map[string][][]interface{}{} 93 } 94 if fake.invocations[key] == nil { 95 fake.invocations[key] = [][]interface{}{} 96 } 97 fake.invocations[key] = append(fake.invocations[key], args) 98 } 99 100 var _ requirements.UserRequirement = new(FakeUserRequirement)