github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/trace/tracefakes/fake_printer.go (about) 1 // This file was generated by counterfeiter 2 package tracefakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/trace" 8 ) 9 10 type FakePrinter struct { 11 PrintStub func(v ...interface{}) 12 printMutex sync.RWMutex 13 printArgsForCall []struct { 14 v []interface{} 15 } 16 PrintfStub func(format string, v ...interface{}) 17 printfMutex sync.RWMutex 18 printfArgsForCall []struct { 19 format string 20 v []interface{} 21 } 22 PrintlnStub func(v ...interface{}) 23 printlnMutex sync.RWMutex 24 printlnArgsForCall []struct { 25 v []interface{} 26 } 27 WritesToConsoleStub func() bool 28 writesToConsoleMutex sync.RWMutex 29 writesToConsoleArgsForCall []struct{} 30 writesToConsoleReturns struct { 31 result1 bool 32 } 33 invocations map[string][][]interface{} 34 invocationsMutex sync.RWMutex 35 } 36 37 func (fake *FakePrinter) Print(v ...interface{}) { 38 fake.printMutex.Lock() 39 fake.printArgsForCall = append(fake.printArgsForCall, struct { 40 v []interface{} 41 }{v}) 42 fake.recordInvocation("Print", []interface{}{v}) 43 fake.printMutex.Unlock() 44 if fake.PrintStub != nil { 45 fake.PrintStub(v...) 46 } 47 } 48 49 func (fake *FakePrinter) PrintCallCount() int { 50 fake.printMutex.RLock() 51 defer fake.printMutex.RUnlock() 52 return len(fake.printArgsForCall) 53 } 54 55 func (fake *FakePrinter) PrintArgsForCall(i int) []interface{} { 56 fake.printMutex.RLock() 57 defer fake.printMutex.RUnlock() 58 return fake.printArgsForCall[i].v 59 } 60 61 func (fake *FakePrinter) Printf(format string, v ...interface{}) { 62 fake.printfMutex.Lock() 63 fake.printfArgsForCall = append(fake.printfArgsForCall, struct { 64 format string 65 v []interface{} 66 }{format, v}) 67 fake.recordInvocation("Printf", []interface{}{format, v}) 68 fake.printfMutex.Unlock() 69 if fake.PrintfStub != nil { 70 fake.PrintfStub(format, v...) 71 } 72 } 73 74 func (fake *FakePrinter) PrintfCallCount() int { 75 fake.printfMutex.RLock() 76 defer fake.printfMutex.RUnlock() 77 return len(fake.printfArgsForCall) 78 } 79 80 func (fake *FakePrinter) PrintfArgsForCall(i int) (string, []interface{}) { 81 fake.printfMutex.RLock() 82 defer fake.printfMutex.RUnlock() 83 return fake.printfArgsForCall[i].format, fake.printfArgsForCall[i].v 84 } 85 86 func (fake *FakePrinter) Println(v ...interface{}) { 87 fake.printlnMutex.Lock() 88 fake.printlnArgsForCall = append(fake.printlnArgsForCall, struct { 89 v []interface{} 90 }{v}) 91 fake.recordInvocation("Println", []interface{}{v}) 92 fake.printlnMutex.Unlock() 93 if fake.PrintlnStub != nil { 94 fake.PrintlnStub(v...) 95 } 96 } 97 98 func (fake *FakePrinter) PrintlnCallCount() int { 99 fake.printlnMutex.RLock() 100 defer fake.printlnMutex.RUnlock() 101 return len(fake.printlnArgsForCall) 102 } 103 104 func (fake *FakePrinter) PrintlnArgsForCall(i int) []interface{} { 105 fake.printlnMutex.RLock() 106 defer fake.printlnMutex.RUnlock() 107 return fake.printlnArgsForCall[i].v 108 } 109 110 func (fake *FakePrinter) WritesToConsole() bool { 111 fake.writesToConsoleMutex.Lock() 112 fake.writesToConsoleArgsForCall = append(fake.writesToConsoleArgsForCall, struct{}{}) 113 fake.recordInvocation("WritesToConsole", []interface{}{}) 114 fake.writesToConsoleMutex.Unlock() 115 if fake.WritesToConsoleStub != nil { 116 return fake.WritesToConsoleStub() 117 } else { 118 return fake.writesToConsoleReturns.result1 119 } 120 } 121 122 func (fake *FakePrinter) WritesToConsoleCallCount() int { 123 fake.writesToConsoleMutex.RLock() 124 defer fake.writesToConsoleMutex.RUnlock() 125 return len(fake.writesToConsoleArgsForCall) 126 } 127 128 func (fake *FakePrinter) WritesToConsoleReturns(result1 bool) { 129 fake.WritesToConsoleStub = nil 130 fake.writesToConsoleReturns = struct { 131 result1 bool 132 }{result1} 133 } 134 135 func (fake *FakePrinter) Invocations() map[string][][]interface{} { 136 fake.invocationsMutex.RLock() 137 defer fake.invocationsMutex.RUnlock() 138 fake.printMutex.RLock() 139 defer fake.printMutex.RUnlock() 140 fake.printfMutex.RLock() 141 defer fake.printfMutex.RUnlock() 142 fake.printlnMutex.RLock() 143 defer fake.printlnMutex.RUnlock() 144 fake.writesToConsoleMutex.RLock() 145 defer fake.writesToConsoleMutex.RUnlock() 146 return fake.invocations 147 } 148 149 func (fake *FakePrinter) recordInvocation(key string, args []interface{}) { 150 fake.invocationsMutex.Lock() 151 defer fake.invocationsMutex.Unlock() 152 if fake.invocations == nil { 153 fake.invocations = map[string][][]interface{}{} 154 } 155 if fake.invocations[key] == nil { 156 fake.invocations[key] = [][]interface{}{} 157 } 158 fake.invocations[key] = append(fake.invocations[key], args) 159 } 160 161 var _ trace.Printer = new(FakePrinter)