github.com/loafoe/cli@v7.1.0+incompatible/cf/requirements/requirementsfakes/fake_config_refresher.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package requirementsfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/configuration/coreconfig" 8 "code.cloudfoundry.org/cli/cf/requirements" 9 ) 10 11 type FakeConfigRefresher struct { 12 RefreshStub func() (coreconfig.Warning, error) 13 refreshMutex sync.RWMutex 14 refreshArgsForCall []struct { 15 } 16 refreshReturns struct { 17 result1 coreconfig.Warning 18 result2 error 19 } 20 refreshReturnsOnCall map[int]struct { 21 result1 coreconfig.Warning 22 result2 error 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *FakeConfigRefresher) Refresh() (coreconfig.Warning, error) { 29 fake.refreshMutex.Lock() 30 ret, specificReturn := fake.refreshReturnsOnCall[len(fake.refreshArgsForCall)] 31 fake.refreshArgsForCall = append(fake.refreshArgsForCall, struct { 32 }{}) 33 fake.recordInvocation("Refresh", []interface{}{}) 34 fake.refreshMutex.Unlock() 35 if fake.RefreshStub != nil { 36 return fake.RefreshStub() 37 } 38 if specificReturn { 39 return ret.result1, ret.result2 40 } 41 fakeReturns := fake.refreshReturns 42 return fakeReturns.result1, fakeReturns.result2 43 } 44 45 func (fake *FakeConfigRefresher) RefreshCallCount() int { 46 fake.refreshMutex.RLock() 47 defer fake.refreshMutex.RUnlock() 48 return len(fake.refreshArgsForCall) 49 } 50 51 func (fake *FakeConfigRefresher) RefreshCalls(stub func() (coreconfig.Warning, error)) { 52 fake.refreshMutex.Lock() 53 defer fake.refreshMutex.Unlock() 54 fake.RefreshStub = stub 55 } 56 57 func (fake *FakeConfigRefresher) RefreshReturns(result1 coreconfig.Warning, result2 error) { 58 fake.refreshMutex.Lock() 59 defer fake.refreshMutex.Unlock() 60 fake.RefreshStub = nil 61 fake.refreshReturns = struct { 62 result1 coreconfig.Warning 63 result2 error 64 }{result1, result2} 65 } 66 67 func (fake *FakeConfigRefresher) RefreshReturnsOnCall(i int, result1 coreconfig.Warning, result2 error) { 68 fake.refreshMutex.Lock() 69 defer fake.refreshMutex.Unlock() 70 fake.RefreshStub = nil 71 if fake.refreshReturnsOnCall == nil { 72 fake.refreshReturnsOnCall = make(map[int]struct { 73 result1 coreconfig.Warning 74 result2 error 75 }) 76 } 77 fake.refreshReturnsOnCall[i] = struct { 78 result1 coreconfig.Warning 79 result2 error 80 }{result1, result2} 81 } 82 83 func (fake *FakeConfigRefresher) Invocations() map[string][][]interface{} { 84 fake.invocationsMutex.RLock() 85 defer fake.invocationsMutex.RUnlock() 86 fake.refreshMutex.RLock() 87 defer fake.refreshMutex.RUnlock() 88 copiedInvocations := map[string][][]interface{}{} 89 for key, value := range fake.invocations { 90 copiedInvocations[key] = value 91 } 92 return copiedInvocations 93 } 94 95 func (fake *FakeConfigRefresher) recordInvocation(key string, args []interface{}) { 96 fake.invocationsMutex.Lock() 97 defer fake.invocationsMutex.Unlock() 98 if fake.invocations == nil { 99 fake.invocations = map[string][][]interface{}{} 100 } 101 if fake.invocations[key] == nil { 102 fake.invocations[key] = [][]interface{}{} 103 } 104 fake.invocations[key] = append(fake.invocations[key], args) 105 } 106 107 var _ requirements.ConfigRefresher = new(FakeConfigRefresher)