github.com/cloudfoundry-incubator/stembuild@v0.0.0-20211223202937-5b61d62226c6/construct/constructfakes/fake_zip_unarchiver.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package constructfakes 3 4 import ( 5 "sync" 6 ) 7 8 type FakeZipUnarchiver struct { 9 UnzipStub func([]byte, string) ([]byte, error) 10 unzipMutex sync.RWMutex 11 unzipArgsForCall []struct { 12 arg1 []byte 13 arg2 string 14 } 15 unzipReturns struct { 16 result1 []byte 17 result2 error 18 } 19 unzipReturnsOnCall map[int]struct { 20 result1 []byte 21 result2 error 22 } 23 invocations map[string][][]interface{} 24 invocationsMutex sync.RWMutex 25 } 26 27 func (fake *FakeZipUnarchiver) Unzip(arg1 []byte, arg2 string) ([]byte, error) { 28 var arg1Copy []byte 29 if arg1 != nil { 30 arg1Copy = make([]byte, len(arg1)) 31 copy(arg1Copy, arg1) 32 } 33 fake.unzipMutex.Lock() 34 ret, specificReturn := fake.unzipReturnsOnCall[len(fake.unzipArgsForCall)] 35 fake.unzipArgsForCall = append(fake.unzipArgsForCall, struct { 36 arg1 []byte 37 arg2 string 38 }{arg1Copy, arg2}) 39 fake.recordInvocation("Unzip", []interface{}{arg1Copy, arg2}) 40 fake.unzipMutex.Unlock() 41 if fake.UnzipStub != nil { 42 return fake.UnzipStub(arg1, arg2) 43 } 44 if specificReturn { 45 return ret.result1, ret.result2 46 } 47 fakeReturns := fake.unzipReturns 48 return fakeReturns.result1, fakeReturns.result2 49 } 50 51 func (fake *FakeZipUnarchiver) UnzipCallCount() int { 52 fake.unzipMutex.RLock() 53 defer fake.unzipMutex.RUnlock() 54 return len(fake.unzipArgsForCall) 55 } 56 57 func (fake *FakeZipUnarchiver) UnzipCalls(stub func([]byte, string) ([]byte, error)) { 58 fake.unzipMutex.Lock() 59 defer fake.unzipMutex.Unlock() 60 fake.UnzipStub = stub 61 } 62 63 func (fake *FakeZipUnarchiver) UnzipArgsForCall(i int) ([]byte, string) { 64 fake.unzipMutex.RLock() 65 defer fake.unzipMutex.RUnlock() 66 argsForCall := fake.unzipArgsForCall[i] 67 return argsForCall.arg1, argsForCall.arg2 68 } 69 70 func (fake *FakeZipUnarchiver) UnzipReturns(result1 []byte, result2 error) { 71 fake.unzipMutex.Lock() 72 defer fake.unzipMutex.Unlock() 73 fake.UnzipStub = nil 74 fake.unzipReturns = struct { 75 result1 []byte 76 result2 error 77 }{result1, result2} 78 } 79 80 func (fake *FakeZipUnarchiver) UnzipReturnsOnCall(i int, result1 []byte, result2 error) { 81 fake.unzipMutex.Lock() 82 defer fake.unzipMutex.Unlock() 83 fake.UnzipStub = nil 84 if fake.unzipReturnsOnCall == nil { 85 fake.unzipReturnsOnCall = make(map[int]struct { 86 result1 []byte 87 result2 error 88 }) 89 } 90 fake.unzipReturnsOnCall[i] = struct { 91 result1 []byte 92 result2 error 93 }{result1, result2} 94 } 95 96 func (fake *FakeZipUnarchiver) Invocations() map[string][][]interface{} { 97 fake.invocationsMutex.RLock() 98 defer fake.invocationsMutex.RUnlock() 99 fake.unzipMutex.RLock() 100 defer fake.unzipMutex.RUnlock() 101 copiedInvocations := map[string][][]interface{}{} 102 for key, value := range fake.invocations { 103 copiedInvocations[key] = value 104 } 105 return copiedInvocations 106 } 107 108 func (fake *FakeZipUnarchiver) recordInvocation(key string, args []interface{}) { 109 fake.invocationsMutex.Lock() 110 defer fake.invocationsMutex.Unlock() 111 if fake.invocations == nil { 112 fake.invocations = map[string][][]interface{}{} 113 } 114 if fake.invocations[key] == nil { 115 fake.invocations[key] = [][]interface{}{} 116 } 117 fake.invocations[key] = append(fake.invocations[key], args) 118 }