github.com/sleungcy-sap/cli@v7.1.0+incompatible/plugin/rpc/rpcfakes/fake_output_capture.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package rpcfakes 3 4 import ( 5 "io" 6 "sync" 7 8 "code.cloudfoundry.org/cli/plugin/rpc" 9 ) 10 11 type FakeOutputCapture struct { 12 SetOutputBucketStub func(io.Writer) 13 setOutputBucketMutex sync.RWMutex 14 setOutputBucketArgsForCall []struct { 15 arg1 io.Writer 16 } 17 invocations map[string][][]interface{} 18 invocationsMutex sync.RWMutex 19 } 20 21 func (fake *FakeOutputCapture) SetOutputBucket(arg1 io.Writer) { 22 fake.setOutputBucketMutex.Lock() 23 fake.setOutputBucketArgsForCall = append(fake.setOutputBucketArgsForCall, struct { 24 arg1 io.Writer 25 }{arg1}) 26 fake.recordInvocation("SetOutputBucket", []interface{}{arg1}) 27 fake.setOutputBucketMutex.Unlock() 28 if fake.SetOutputBucketStub != nil { 29 fake.SetOutputBucketStub(arg1) 30 } 31 } 32 33 func (fake *FakeOutputCapture) SetOutputBucketCallCount() int { 34 fake.setOutputBucketMutex.RLock() 35 defer fake.setOutputBucketMutex.RUnlock() 36 return len(fake.setOutputBucketArgsForCall) 37 } 38 39 func (fake *FakeOutputCapture) SetOutputBucketCalls(stub func(io.Writer)) { 40 fake.setOutputBucketMutex.Lock() 41 defer fake.setOutputBucketMutex.Unlock() 42 fake.SetOutputBucketStub = stub 43 } 44 45 func (fake *FakeOutputCapture) SetOutputBucketArgsForCall(i int) io.Writer { 46 fake.setOutputBucketMutex.RLock() 47 defer fake.setOutputBucketMutex.RUnlock() 48 argsForCall := fake.setOutputBucketArgsForCall[i] 49 return argsForCall.arg1 50 } 51 52 func (fake *FakeOutputCapture) Invocations() map[string][][]interface{} { 53 fake.invocationsMutex.RLock() 54 defer fake.invocationsMutex.RUnlock() 55 fake.setOutputBucketMutex.RLock() 56 defer fake.setOutputBucketMutex.RUnlock() 57 copiedInvocations := map[string][][]interface{}{} 58 for key, value := range fake.invocations { 59 copiedInvocations[key] = value 60 } 61 return copiedInvocations 62 } 63 64 func (fake *FakeOutputCapture) recordInvocation(key string, args []interface{}) { 65 fake.invocationsMutex.Lock() 66 defer fake.invocationsMutex.Unlock() 67 if fake.invocations == nil { 68 fake.invocations = map[string][][]interface{}{} 69 } 70 if fake.invocations[key] == nil { 71 fake.invocations[key] = [][]interface{}{} 72 } 73 fake.invocations[key] = append(fake.invocations[key], args) 74 } 75 76 var _ rpc.OutputCapture = new(FakeOutputCapture)