github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/apifakes/fake_client_repository.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package apifakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api" 8 ) 9 10 type FakeClientRepository struct { 11 ClientExistsStub func(string) (bool, error) 12 clientExistsMutex sync.RWMutex 13 clientExistsArgsForCall []struct { 14 arg1 string 15 } 16 clientExistsReturns struct { 17 result1 bool 18 result2 error 19 } 20 clientExistsReturnsOnCall map[int]struct { 21 result1 bool 22 result2 error 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *FakeClientRepository) ClientExists(arg1 string) (bool, error) { 29 fake.clientExistsMutex.Lock() 30 ret, specificReturn := fake.clientExistsReturnsOnCall[len(fake.clientExistsArgsForCall)] 31 fake.clientExistsArgsForCall = append(fake.clientExistsArgsForCall, struct { 32 arg1 string 33 }{arg1}) 34 fake.recordInvocation("ClientExists", []interface{}{arg1}) 35 fake.clientExistsMutex.Unlock() 36 if fake.ClientExistsStub != nil { 37 return fake.ClientExistsStub(arg1) 38 } 39 if specificReturn { 40 return ret.result1, ret.result2 41 } 42 fakeReturns := fake.clientExistsReturns 43 return fakeReturns.result1, fakeReturns.result2 44 } 45 46 func (fake *FakeClientRepository) ClientExistsCallCount() int { 47 fake.clientExistsMutex.RLock() 48 defer fake.clientExistsMutex.RUnlock() 49 return len(fake.clientExistsArgsForCall) 50 } 51 52 func (fake *FakeClientRepository) ClientExistsCalls(stub func(string) (bool, error)) { 53 fake.clientExistsMutex.Lock() 54 defer fake.clientExistsMutex.Unlock() 55 fake.ClientExistsStub = stub 56 } 57 58 func (fake *FakeClientRepository) ClientExistsArgsForCall(i int) string { 59 fake.clientExistsMutex.RLock() 60 defer fake.clientExistsMutex.RUnlock() 61 argsForCall := fake.clientExistsArgsForCall[i] 62 return argsForCall.arg1 63 } 64 65 func (fake *FakeClientRepository) ClientExistsReturns(result1 bool, result2 error) { 66 fake.clientExistsMutex.Lock() 67 defer fake.clientExistsMutex.Unlock() 68 fake.ClientExistsStub = nil 69 fake.clientExistsReturns = struct { 70 result1 bool 71 result2 error 72 }{result1, result2} 73 } 74 75 func (fake *FakeClientRepository) ClientExistsReturnsOnCall(i int, result1 bool, result2 error) { 76 fake.clientExistsMutex.Lock() 77 defer fake.clientExistsMutex.Unlock() 78 fake.ClientExistsStub = nil 79 if fake.clientExistsReturnsOnCall == nil { 80 fake.clientExistsReturnsOnCall = make(map[int]struct { 81 result1 bool 82 result2 error 83 }) 84 } 85 fake.clientExistsReturnsOnCall[i] = struct { 86 result1 bool 87 result2 error 88 }{result1, result2} 89 } 90 91 func (fake *FakeClientRepository) Invocations() map[string][][]interface{} { 92 fake.invocationsMutex.RLock() 93 defer fake.invocationsMutex.RUnlock() 94 fake.clientExistsMutex.RLock() 95 defer fake.clientExistsMutex.RUnlock() 96 copiedInvocations := map[string][][]interface{}{} 97 for key, value := range fake.invocations { 98 copiedInvocations[key] = value 99 } 100 return copiedInvocations 101 } 102 103 func (fake *FakeClientRepository) recordInvocation(key string, args []interface{}) { 104 fake.invocationsMutex.Lock() 105 defer fake.invocationsMutex.Unlock() 106 if fake.invocations == nil { 107 fake.invocations = map[string][][]interface{}{} 108 } 109 if fake.invocations[key] == nil { 110 fake.invocations[key] = [][]interface{}{} 111 } 112 fake.invocations[key] = append(fake.invocations[key], args) 113 } 114 115 var _ api.ClientRepository = new(FakeClientRepository)