github.com/sleungcy/cli@v7.1.0+incompatible/api/uaa/uaafakes/fake_connection.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package uaafakes 3 4 import ( 5 "net/http" 6 "sync" 7 8 "code.cloudfoundry.org/cli/api/uaa" 9 ) 10 11 type FakeConnection struct { 12 MakeStub func(*http.Request, *uaa.Response) error 13 makeMutex sync.RWMutex 14 makeArgsForCall []struct { 15 arg1 *http.Request 16 arg2 *uaa.Response 17 } 18 makeReturns struct { 19 result1 error 20 } 21 makeReturnsOnCall map[int]struct { 22 result1 error 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *FakeConnection) Make(arg1 *http.Request, arg2 *uaa.Response) error { 29 fake.makeMutex.Lock() 30 ret, specificReturn := fake.makeReturnsOnCall[len(fake.makeArgsForCall)] 31 fake.makeArgsForCall = append(fake.makeArgsForCall, struct { 32 arg1 *http.Request 33 arg2 *uaa.Response 34 }{arg1, arg2}) 35 fake.recordInvocation("Make", []interface{}{arg1, arg2}) 36 fake.makeMutex.Unlock() 37 if fake.MakeStub != nil { 38 return fake.MakeStub(arg1, arg2) 39 } 40 if specificReturn { 41 return ret.result1 42 } 43 fakeReturns := fake.makeReturns 44 return fakeReturns.result1 45 } 46 47 func (fake *FakeConnection) MakeCallCount() int { 48 fake.makeMutex.RLock() 49 defer fake.makeMutex.RUnlock() 50 return len(fake.makeArgsForCall) 51 } 52 53 func (fake *FakeConnection) MakeCalls(stub func(*http.Request, *uaa.Response) error) { 54 fake.makeMutex.Lock() 55 defer fake.makeMutex.Unlock() 56 fake.MakeStub = stub 57 } 58 59 func (fake *FakeConnection) MakeArgsForCall(i int) (*http.Request, *uaa.Response) { 60 fake.makeMutex.RLock() 61 defer fake.makeMutex.RUnlock() 62 argsForCall := fake.makeArgsForCall[i] 63 return argsForCall.arg1, argsForCall.arg2 64 } 65 66 func (fake *FakeConnection) MakeReturns(result1 error) { 67 fake.makeMutex.Lock() 68 defer fake.makeMutex.Unlock() 69 fake.MakeStub = nil 70 fake.makeReturns = struct { 71 result1 error 72 }{result1} 73 } 74 75 func (fake *FakeConnection) MakeReturnsOnCall(i int, result1 error) { 76 fake.makeMutex.Lock() 77 defer fake.makeMutex.Unlock() 78 fake.MakeStub = nil 79 if fake.makeReturnsOnCall == nil { 80 fake.makeReturnsOnCall = make(map[int]struct { 81 result1 error 82 }) 83 } 84 fake.makeReturnsOnCall[i] = struct { 85 result1 error 86 }{result1} 87 } 88 89 func (fake *FakeConnection) Invocations() map[string][][]interface{} { 90 fake.invocationsMutex.RLock() 91 defer fake.invocationsMutex.RUnlock() 92 fake.makeMutex.RLock() 93 defer fake.makeMutex.RUnlock() 94 copiedInvocations := map[string][][]interface{}{} 95 for key, value := range fake.invocations { 96 copiedInvocations[key] = value 97 } 98 return copiedInvocations 99 } 100 101 func (fake *FakeConnection) recordInvocation(key string, args []interface{}) { 102 fake.invocationsMutex.Lock() 103 defer fake.invocationsMutex.Unlock() 104 if fake.invocations == nil { 105 fake.invocations = map[string][][]interface{}{} 106 } 107 if fake.invocations[key] == nil { 108 fake.invocations[key] = [][]interface{}{} 109 } 110 fake.invocations[key] = append(fake.invocations[key], args) 111 } 112 113 var _ uaa.Connection = new(FakeConnection)