github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/featureflags/featureflagsfakes/fake_feature_flag_repository.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 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 FindByNameStub func(string) (models.FeatureFlag, error) 13 findByNameMutex sync.RWMutex 14 findByNameArgsForCall []struct { 15 arg1 string 16 } 17 findByNameReturns struct { 18 result1 models.FeatureFlag 19 result2 error 20 } 21 findByNameReturnsOnCall map[int]struct { 22 result1 models.FeatureFlag 23 result2 error 24 } 25 ListStub func() ([]models.FeatureFlag, error) 26 listMutex sync.RWMutex 27 listArgsForCall []struct { 28 } 29 listReturns struct { 30 result1 []models.FeatureFlag 31 result2 error 32 } 33 listReturnsOnCall map[int]struct { 34 result1 []models.FeatureFlag 35 result2 error 36 } 37 UpdateStub func(string, bool) error 38 updateMutex sync.RWMutex 39 updateArgsForCall []struct { 40 arg1 string 41 arg2 bool 42 } 43 updateReturns struct { 44 result1 error 45 } 46 updateReturnsOnCall map[int]struct { 47 result1 error 48 } 49 invocations map[string][][]interface{} 50 invocationsMutex sync.RWMutex 51 } 52 53 func (fake *FakeFeatureFlagRepository) FindByName(arg1 string) (models.FeatureFlag, error) { 54 fake.findByNameMutex.Lock() 55 ret, specificReturn := fake.findByNameReturnsOnCall[len(fake.findByNameArgsForCall)] 56 fake.findByNameArgsForCall = append(fake.findByNameArgsForCall, struct { 57 arg1 string 58 }{arg1}) 59 fake.recordInvocation("FindByName", []interface{}{arg1}) 60 fake.findByNameMutex.Unlock() 61 if fake.FindByNameStub != nil { 62 return fake.FindByNameStub(arg1) 63 } 64 if specificReturn { 65 return ret.result1, ret.result2 66 } 67 fakeReturns := fake.findByNameReturns 68 return fakeReturns.result1, fakeReturns.result2 69 } 70 71 func (fake *FakeFeatureFlagRepository) FindByNameCallCount() int { 72 fake.findByNameMutex.RLock() 73 defer fake.findByNameMutex.RUnlock() 74 return len(fake.findByNameArgsForCall) 75 } 76 77 func (fake *FakeFeatureFlagRepository) FindByNameCalls(stub func(string) (models.FeatureFlag, error)) { 78 fake.findByNameMutex.Lock() 79 defer fake.findByNameMutex.Unlock() 80 fake.FindByNameStub = stub 81 } 82 83 func (fake *FakeFeatureFlagRepository) FindByNameArgsForCall(i int) string { 84 fake.findByNameMutex.RLock() 85 defer fake.findByNameMutex.RUnlock() 86 argsForCall := fake.findByNameArgsForCall[i] 87 return argsForCall.arg1 88 } 89 90 func (fake *FakeFeatureFlagRepository) FindByNameReturns(result1 models.FeatureFlag, result2 error) { 91 fake.findByNameMutex.Lock() 92 defer fake.findByNameMutex.Unlock() 93 fake.FindByNameStub = nil 94 fake.findByNameReturns = struct { 95 result1 models.FeatureFlag 96 result2 error 97 }{result1, result2} 98 } 99 100 func (fake *FakeFeatureFlagRepository) FindByNameReturnsOnCall(i int, result1 models.FeatureFlag, result2 error) { 101 fake.findByNameMutex.Lock() 102 defer fake.findByNameMutex.Unlock() 103 fake.FindByNameStub = nil 104 if fake.findByNameReturnsOnCall == nil { 105 fake.findByNameReturnsOnCall = make(map[int]struct { 106 result1 models.FeatureFlag 107 result2 error 108 }) 109 } 110 fake.findByNameReturnsOnCall[i] = struct { 111 result1 models.FeatureFlag 112 result2 error 113 }{result1, result2} 114 } 115 116 func (fake *FakeFeatureFlagRepository) List() ([]models.FeatureFlag, error) { 117 fake.listMutex.Lock() 118 ret, specificReturn := fake.listReturnsOnCall[len(fake.listArgsForCall)] 119 fake.listArgsForCall = append(fake.listArgsForCall, struct { 120 }{}) 121 fake.recordInvocation("List", []interface{}{}) 122 fake.listMutex.Unlock() 123 if fake.ListStub != nil { 124 return fake.ListStub() 125 } 126 if specificReturn { 127 return ret.result1, ret.result2 128 } 129 fakeReturns := fake.listReturns 130 return fakeReturns.result1, fakeReturns.result2 131 } 132 133 func (fake *FakeFeatureFlagRepository) ListCallCount() int { 134 fake.listMutex.RLock() 135 defer fake.listMutex.RUnlock() 136 return len(fake.listArgsForCall) 137 } 138 139 func (fake *FakeFeatureFlagRepository) ListCalls(stub func() ([]models.FeatureFlag, error)) { 140 fake.listMutex.Lock() 141 defer fake.listMutex.Unlock() 142 fake.ListStub = stub 143 } 144 145 func (fake *FakeFeatureFlagRepository) ListReturns(result1 []models.FeatureFlag, result2 error) { 146 fake.listMutex.Lock() 147 defer fake.listMutex.Unlock() 148 fake.ListStub = nil 149 fake.listReturns = struct { 150 result1 []models.FeatureFlag 151 result2 error 152 }{result1, result2} 153 } 154 155 func (fake *FakeFeatureFlagRepository) ListReturnsOnCall(i int, result1 []models.FeatureFlag, result2 error) { 156 fake.listMutex.Lock() 157 defer fake.listMutex.Unlock() 158 fake.ListStub = nil 159 if fake.listReturnsOnCall == nil { 160 fake.listReturnsOnCall = make(map[int]struct { 161 result1 []models.FeatureFlag 162 result2 error 163 }) 164 } 165 fake.listReturnsOnCall[i] = struct { 166 result1 []models.FeatureFlag 167 result2 error 168 }{result1, result2} 169 } 170 171 func (fake *FakeFeatureFlagRepository) Update(arg1 string, arg2 bool) error { 172 fake.updateMutex.Lock() 173 ret, specificReturn := fake.updateReturnsOnCall[len(fake.updateArgsForCall)] 174 fake.updateArgsForCall = append(fake.updateArgsForCall, struct { 175 arg1 string 176 arg2 bool 177 }{arg1, arg2}) 178 fake.recordInvocation("Update", []interface{}{arg1, arg2}) 179 fake.updateMutex.Unlock() 180 if fake.UpdateStub != nil { 181 return fake.UpdateStub(arg1, arg2) 182 } 183 if specificReturn { 184 return ret.result1 185 } 186 fakeReturns := fake.updateReturns 187 return fakeReturns.result1 188 } 189 190 func (fake *FakeFeatureFlagRepository) UpdateCallCount() int { 191 fake.updateMutex.RLock() 192 defer fake.updateMutex.RUnlock() 193 return len(fake.updateArgsForCall) 194 } 195 196 func (fake *FakeFeatureFlagRepository) UpdateCalls(stub func(string, bool) error) { 197 fake.updateMutex.Lock() 198 defer fake.updateMutex.Unlock() 199 fake.UpdateStub = stub 200 } 201 202 func (fake *FakeFeatureFlagRepository) UpdateArgsForCall(i int) (string, bool) { 203 fake.updateMutex.RLock() 204 defer fake.updateMutex.RUnlock() 205 argsForCall := fake.updateArgsForCall[i] 206 return argsForCall.arg1, argsForCall.arg2 207 } 208 209 func (fake *FakeFeatureFlagRepository) UpdateReturns(result1 error) { 210 fake.updateMutex.Lock() 211 defer fake.updateMutex.Unlock() 212 fake.UpdateStub = nil 213 fake.updateReturns = struct { 214 result1 error 215 }{result1} 216 } 217 218 func (fake *FakeFeatureFlagRepository) UpdateReturnsOnCall(i int, result1 error) { 219 fake.updateMutex.Lock() 220 defer fake.updateMutex.Unlock() 221 fake.UpdateStub = nil 222 if fake.updateReturnsOnCall == nil { 223 fake.updateReturnsOnCall = make(map[int]struct { 224 result1 error 225 }) 226 } 227 fake.updateReturnsOnCall[i] = struct { 228 result1 error 229 }{result1} 230 } 231 232 func (fake *FakeFeatureFlagRepository) Invocations() map[string][][]interface{} { 233 fake.invocationsMutex.RLock() 234 defer fake.invocationsMutex.RUnlock() 235 fake.findByNameMutex.RLock() 236 defer fake.findByNameMutex.RUnlock() 237 fake.listMutex.RLock() 238 defer fake.listMutex.RUnlock() 239 fake.updateMutex.RLock() 240 defer fake.updateMutex.RUnlock() 241 copiedInvocations := map[string][][]interface{}{} 242 for key, value := range fake.invocations { 243 copiedInvocations[key] = value 244 } 245 return copiedInvocations 246 } 247 248 func (fake *FakeFeatureFlagRepository) recordInvocation(key string, args []interface{}) { 249 fake.invocationsMutex.Lock() 250 defer fake.invocationsMutex.Unlock() 251 if fake.invocations == nil { 252 fake.invocations = map[string][][]interface{}{} 253 } 254 if fake.invocations[key] == nil { 255 fake.invocations[key] = [][]interface{}{} 256 } 257 fake.invocations[key] = append(fake.invocations[key], args) 258 } 259 260 var _ featureflags.FeatureFlagRepository = new(FakeFeatureFlagRepository)