github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/trace/tracefakes/fake_printer.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 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(...interface{}) 12 printMutex sync.RWMutex 13 printArgsForCall []struct { 14 arg1 []interface{} 15 } 16 PrintfStub func(string, ...interface{}) 17 printfMutex sync.RWMutex 18 printfArgsForCall []struct { 19 arg1 string 20 arg2 []interface{} 21 } 22 PrintlnStub func(...interface{}) 23 printlnMutex sync.RWMutex 24 printlnArgsForCall []struct { 25 arg1 []interface{} 26 } 27 WritesToConsoleStub func() bool 28 writesToConsoleMutex sync.RWMutex 29 writesToConsoleArgsForCall []struct { 30 } 31 writesToConsoleReturns struct { 32 result1 bool 33 } 34 writesToConsoleReturnsOnCall map[int]struct { 35 result1 bool 36 } 37 invocations map[string][][]interface{} 38 invocationsMutex sync.RWMutex 39 } 40 41 func (fake *FakePrinter) Print(arg1 ...interface{}) { 42 fake.printMutex.Lock() 43 fake.printArgsForCall = append(fake.printArgsForCall, struct { 44 arg1 []interface{} 45 }{arg1}) 46 fake.recordInvocation("Print", []interface{}{arg1}) 47 fake.printMutex.Unlock() 48 if fake.PrintStub != nil { 49 fake.PrintStub(arg1...) 50 } 51 } 52 53 func (fake *FakePrinter) PrintCallCount() int { 54 fake.printMutex.RLock() 55 defer fake.printMutex.RUnlock() 56 return len(fake.printArgsForCall) 57 } 58 59 func (fake *FakePrinter) PrintCalls(stub func(...interface{})) { 60 fake.printMutex.Lock() 61 defer fake.printMutex.Unlock() 62 fake.PrintStub = stub 63 } 64 65 func (fake *FakePrinter) PrintArgsForCall(i int) []interface{} { 66 fake.printMutex.RLock() 67 defer fake.printMutex.RUnlock() 68 argsForCall := fake.printArgsForCall[i] 69 return argsForCall.arg1 70 } 71 72 func (fake *FakePrinter) Printf(arg1 string, arg2 ...interface{}) { 73 fake.printfMutex.Lock() 74 fake.printfArgsForCall = append(fake.printfArgsForCall, struct { 75 arg1 string 76 arg2 []interface{} 77 }{arg1, arg2}) 78 fake.recordInvocation("Printf", []interface{}{arg1, arg2}) 79 fake.printfMutex.Unlock() 80 if fake.PrintfStub != nil { 81 fake.PrintfStub(arg1, arg2...) 82 } 83 } 84 85 func (fake *FakePrinter) PrintfCallCount() int { 86 fake.printfMutex.RLock() 87 defer fake.printfMutex.RUnlock() 88 return len(fake.printfArgsForCall) 89 } 90 91 func (fake *FakePrinter) PrintfCalls(stub func(string, ...interface{})) { 92 fake.printfMutex.Lock() 93 defer fake.printfMutex.Unlock() 94 fake.PrintfStub = stub 95 } 96 97 func (fake *FakePrinter) PrintfArgsForCall(i int) (string, []interface{}) { 98 fake.printfMutex.RLock() 99 defer fake.printfMutex.RUnlock() 100 argsForCall := fake.printfArgsForCall[i] 101 return argsForCall.arg1, argsForCall.arg2 102 } 103 104 func (fake *FakePrinter) Println(arg1 ...interface{}) { 105 fake.printlnMutex.Lock() 106 fake.printlnArgsForCall = append(fake.printlnArgsForCall, struct { 107 arg1 []interface{} 108 }{arg1}) 109 fake.recordInvocation("Println", []interface{}{arg1}) 110 fake.printlnMutex.Unlock() 111 if fake.PrintlnStub != nil { 112 fake.PrintlnStub(arg1...) 113 } 114 } 115 116 func (fake *FakePrinter) PrintlnCallCount() int { 117 fake.printlnMutex.RLock() 118 defer fake.printlnMutex.RUnlock() 119 return len(fake.printlnArgsForCall) 120 } 121 122 func (fake *FakePrinter) PrintlnCalls(stub func(...interface{})) { 123 fake.printlnMutex.Lock() 124 defer fake.printlnMutex.Unlock() 125 fake.PrintlnStub = stub 126 } 127 128 func (fake *FakePrinter) PrintlnArgsForCall(i int) []interface{} { 129 fake.printlnMutex.RLock() 130 defer fake.printlnMutex.RUnlock() 131 argsForCall := fake.printlnArgsForCall[i] 132 return argsForCall.arg1 133 } 134 135 func (fake *FakePrinter) WritesToConsole() bool { 136 fake.writesToConsoleMutex.Lock() 137 ret, specificReturn := fake.writesToConsoleReturnsOnCall[len(fake.writesToConsoleArgsForCall)] 138 fake.writesToConsoleArgsForCall = append(fake.writesToConsoleArgsForCall, struct { 139 }{}) 140 fake.recordInvocation("WritesToConsole", []interface{}{}) 141 fake.writesToConsoleMutex.Unlock() 142 if fake.WritesToConsoleStub != nil { 143 return fake.WritesToConsoleStub() 144 } 145 if specificReturn { 146 return ret.result1 147 } 148 fakeReturns := fake.writesToConsoleReturns 149 return fakeReturns.result1 150 } 151 152 func (fake *FakePrinter) WritesToConsoleCallCount() int { 153 fake.writesToConsoleMutex.RLock() 154 defer fake.writesToConsoleMutex.RUnlock() 155 return len(fake.writesToConsoleArgsForCall) 156 } 157 158 func (fake *FakePrinter) WritesToConsoleCalls(stub func() bool) { 159 fake.writesToConsoleMutex.Lock() 160 defer fake.writesToConsoleMutex.Unlock() 161 fake.WritesToConsoleStub = stub 162 } 163 164 func (fake *FakePrinter) WritesToConsoleReturns(result1 bool) { 165 fake.writesToConsoleMutex.Lock() 166 defer fake.writesToConsoleMutex.Unlock() 167 fake.WritesToConsoleStub = nil 168 fake.writesToConsoleReturns = struct { 169 result1 bool 170 }{result1} 171 } 172 173 func (fake *FakePrinter) WritesToConsoleReturnsOnCall(i int, result1 bool) { 174 fake.writesToConsoleMutex.Lock() 175 defer fake.writesToConsoleMutex.Unlock() 176 fake.WritesToConsoleStub = nil 177 if fake.writesToConsoleReturnsOnCall == nil { 178 fake.writesToConsoleReturnsOnCall = make(map[int]struct { 179 result1 bool 180 }) 181 } 182 fake.writesToConsoleReturnsOnCall[i] = struct { 183 result1 bool 184 }{result1} 185 } 186 187 func (fake *FakePrinter) Invocations() map[string][][]interface{} { 188 fake.invocationsMutex.RLock() 189 defer fake.invocationsMutex.RUnlock() 190 fake.printMutex.RLock() 191 defer fake.printMutex.RUnlock() 192 fake.printfMutex.RLock() 193 defer fake.printfMutex.RUnlock() 194 fake.printlnMutex.RLock() 195 defer fake.printlnMutex.RUnlock() 196 fake.writesToConsoleMutex.RLock() 197 defer fake.writesToConsoleMutex.RUnlock() 198 copiedInvocations := map[string][][]interface{}{} 199 for key, value := range fake.invocations { 200 copiedInvocations[key] = value 201 } 202 return copiedInvocations 203 } 204 205 func (fake *FakePrinter) recordInvocation(key string, args []interface{}) { 206 fake.invocationsMutex.Lock() 207 defer fake.invocationsMutex.Unlock() 208 if fake.invocations == nil { 209 fake.invocations = map[string][][]interface{}{} 210 } 211 if fake.invocations[key] == nil { 212 fake.invocations[key] = [][]interface{}{} 213 } 214 fake.invocations[key] = append(fake.invocations[key], args) 215 } 216 217 var _ trace.Printer = new(FakePrinter)