github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/cloudcontroller/ccv3/ccv3fakes/fake_reader.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package ccv3fakes 3 4 import ( 5 "io" 6 "sync" 7 ) 8 9 type FakeReader struct { 10 ReadStub func([]byte) (int, error) 11 readMutex sync.RWMutex 12 readArgsForCall []struct { 13 arg1 []byte 14 } 15 readReturns struct { 16 result1 int 17 result2 error 18 } 19 readReturnsOnCall map[int]struct { 20 result1 int 21 result2 error 22 } 23 invocations map[string][][]interface{} 24 invocationsMutex sync.RWMutex 25 } 26 27 func (fake *FakeReader) Read(arg1 []byte) (int, error) { 28 var arg1Copy []byte 29 if arg1 != nil { 30 arg1Copy = make([]byte, len(arg1)) 31 copy(arg1Copy, arg1) 32 } 33 fake.readMutex.Lock() 34 ret, specificReturn := fake.readReturnsOnCall[len(fake.readArgsForCall)] 35 fake.readArgsForCall = append(fake.readArgsForCall, struct { 36 arg1 []byte 37 }{arg1Copy}) 38 fake.recordInvocation("Read", []interface{}{arg1Copy}) 39 fake.readMutex.Unlock() 40 if fake.ReadStub != nil { 41 return fake.ReadStub(arg1) 42 } 43 if specificReturn { 44 return ret.result1, ret.result2 45 } 46 fakeReturns := fake.readReturns 47 return fakeReturns.result1, fakeReturns.result2 48 } 49 50 func (fake *FakeReader) ReadCallCount() int { 51 fake.readMutex.RLock() 52 defer fake.readMutex.RUnlock() 53 return len(fake.readArgsForCall) 54 } 55 56 func (fake *FakeReader) ReadCalls(stub func([]byte) (int, error)) { 57 fake.readMutex.Lock() 58 defer fake.readMutex.Unlock() 59 fake.ReadStub = stub 60 } 61 62 func (fake *FakeReader) ReadArgsForCall(i int) []byte { 63 fake.readMutex.RLock() 64 defer fake.readMutex.RUnlock() 65 argsForCall := fake.readArgsForCall[i] 66 return argsForCall.arg1 67 } 68 69 func (fake *FakeReader) ReadReturns(result1 int, result2 error) { 70 fake.readMutex.Lock() 71 defer fake.readMutex.Unlock() 72 fake.ReadStub = nil 73 fake.readReturns = struct { 74 result1 int 75 result2 error 76 }{result1, result2} 77 } 78 79 func (fake *FakeReader) ReadReturnsOnCall(i int, result1 int, result2 error) { 80 fake.readMutex.Lock() 81 defer fake.readMutex.Unlock() 82 fake.ReadStub = nil 83 if fake.readReturnsOnCall == nil { 84 fake.readReturnsOnCall = make(map[int]struct { 85 result1 int 86 result2 error 87 }) 88 } 89 fake.readReturnsOnCall[i] = struct { 90 result1 int 91 result2 error 92 }{result1, result2} 93 } 94 95 func (fake *FakeReader) Invocations() map[string][][]interface{} { 96 fake.invocationsMutex.RLock() 97 defer fake.invocationsMutex.RUnlock() 98 fake.readMutex.RLock() 99 defer fake.readMutex.RUnlock() 100 copiedInvocations := map[string][][]interface{}{} 101 for key, value := range fake.invocations { 102 copiedInvocations[key] = value 103 } 104 return copiedInvocations 105 } 106 107 func (fake *FakeReader) recordInvocation(key string, args []interface{}) { 108 fake.invocationsMutex.Lock() 109 defer fake.invocationsMutex.Unlock() 110 if fake.invocations == nil { 111 fake.invocations = map[string][][]interface{}{} 112 } 113 if fake.invocations[key] == nil { 114 fake.invocations[key] = [][]interface{}{} 115 } 116 fake.invocations[key] = append(fake.invocations[key], args) 117 } 118 119 var _ io.Reader = new(FakeReader)