github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/cf/api/featureflags/featureflagsfakes/fake_feature_flag_repository.go (about) 1 // This file was generated by counterfeiter 2 package featureflagsfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/featureflags" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeFeatureFlagRepository struct { 12 ListStub func() ([]models.FeatureFlag, error) 13 listMutex sync.RWMutex 14 listArgsForCall []struct{} 15 listReturns struct { 16 result1 []models.FeatureFlag 17 result2 error 18 } 19 FindByNameStub func(string) (models.FeatureFlag, error) 20 findByNameMutex sync.RWMutex 21 findByNameArgsForCall []struct { 22 arg1 string 23 } 24 findByNameReturns struct { 25 result1 models.FeatureFlag 26 result2 error 27 } 28 UpdateStub func(string, bool) error 29 updateMutex sync.RWMutex 30 updateArgsForCall []struct { 31 arg1 string 32 arg2 bool 33 } 34 updateReturns struct { 35 result1 error 36 } 37 invocations map[string][][]interface{} 38 invocationsMutex sync.RWMutex 39 } 40 41 func (fake *FakeFeatureFlagRepository) List() ([]models.FeatureFlag, error) { 42 fake.listMutex.Lock() 43 fake.listArgsForCall = append(fake.listArgsForCall, struct{}{}) 44 fake.recordInvocation("List", []interface{}{}) 45 fake.listMutex.Unlock() 46 if fake.ListStub != nil { 47 return fake.ListStub() 48 } else { 49 return fake.listReturns.result1, fake.listReturns.result2 50 } 51 } 52 53 func (fake *FakeFeatureFlagRepository) ListCallCount() int { 54 fake.listMutex.RLock() 55 defer fake.listMutex.RUnlock() 56 return len(fake.listArgsForCall) 57 } 58 59 func (fake *FakeFeatureFlagRepository) ListReturns(result1 []models.FeatureFlag, result2 error) { 60 fake.ListStub = nil 61 fake.listReturns = struct { 62 result1 []models.FeatureFlag 63 result2 error 64 }{result1, result2} 65 } 66 67 func (fake *FakeFeatureFlagRepository) FindByName(arg1 string) (models.FeatureFlag, error) { 68 fake.findByNameMutex.Lock() 69 fake.findByNameArgsForCall = append(fake.findByNameArgsForCall, struct { 70 arg1 string 71 }{arg1}) 72 fake.recordInvocation("FindByName", []interface{}{arg1}) 73 fake.findByNameMutex.Unlock() 74 if fake.FindByNameStub != nil { 75 return fake.FindByNameStub(arg1) 76 } else { 77 return fake.findByNameReturns.result1, fake.findByNameReturns.result2 78 } 79 } 80 81 func (fake *FakeFeatureFlagRepository) FindByNameCallCount() int { 82 fake.findByNameMutex.RLock() 83 defer fake.findByNameMutex.RUnlock() 84 return len(fake.findByNameArgsForCall) 85 } 86 87 func (fake *FakeFeatureFlagRepository) FindByNameArgsForCall(i int) string { 88 fake.findByNameMutex.RLock() 89 defer fake.findByNameMutex.RUnlock() 90 return fake.findByNameArgsForCall[i].arg1 91 } 92 93 func (fake *FakeFeatureFlagRepository) FindByNameReturns(result1 models.FeatureFlag, result2 error) { 94 fake.FindByNameStub = nil 95 fake.findByNameReturns = struct { 96 result1 models.FeatureFlag 97 result2 error 98 }{result1, result2} 99 } 100 101 func (fake *FakeFeatureFlagRepository) Update(arg1 string, arg2 bool) error { 102 fake.updateMutex.Lock() 103 fake.updateArgsForCall = append(fake.updateArgsForCall, struct { 104 arg1 string 105 arg2 bool 106 }{arg1, arg2}) 107 fake.recordInvocation("Update", []interface{}{arg1, arg2}) 108 fake.updateMutex.Unlock() 109 if fake.UpdateStub != nil { 110 return fake.UpdateStub(arg1, arg2) 111 } else { 112 return fake.updateReturns.result1 113 } 114 } 115 116 func (fake *FakeFeatureFlagRepository) UpdateCallCount() int { 117 fake.updateMutex.RLock() 118 defer fake.updateMutex.RUnlock() 119 return len(fake.updateArgsForCall) 120 } 121 122 func (fake *FakeFeatureFlagRepository) UpdateArgsForCall(i int) (string, bool) { 123 fake.updateMutex.RLock() 124 defer fake.updateMutex.RUnlock() 125 return fake.updateArgsForCall[i].arg1, fake.updateArgsForCall[i].arg2 126 } 127 128 func (fake *FakeFeatureFlagRepository) UpdateReturns(result1 error) { 129 fake.UpdateStub = nil 130 fake.updateReturns = struct { 131 result1 error 132 }{result1} 133 } 134 135 func (fake *FakeFeatureFlagRepository) Invocations() map[string][][]interface{} { 136 fake.invocationsMutex.RLock() 137 defer fake.invocationsMutex.RUnlock() 138 fake.listMutex.RLock() 139 defer fake.listMutex.RUnlock() 140 fake.findByNameMutex.RLock() 141 defer fake.findByNameMutex.RUnlock() 142 fake.updateMutex.RLock() 143 defer fake.updateMutex.RUnlock() 144 return fake.invocations 145 } 146 147 func (fake *FakeFeatureFlagRepository) recordInvocation(key string, args []interface{}) { 148 fake.invocationsMutex.Lock() 149 defer fake.invocationsMutex.Unlock() 150 if fake.invocations == nil { 151 fake.invocations = map[string][][]interface{}{} 152 } 153 if fake.invocations[key] == nil { 154 fake.invocations[key] = [][]interface{}{} 155 } 156 fake.invocations[key] = append(fake.invocations[key], args) 157 } 158 159 var _ featureflags.FeatureFlagRepository = new(FakeFeatureFlagRepository)