github.com/liamawhite/cli-with-i18n@v6.32.1-0.20171122084555-dede0a5c3448+incompatible/cf/terminal/terminalfakes/fake_ui.go (about) 1 // This file was generated by counterfeiter 2 package terminalfakes 3 4 import ( 5 "io" 6 "sync" 7 8 "github.com/liamawhite/cli-with-i18n/cf/configuration/coreconfig" 9 "github.com/liamawhite/cli-with-i18n/cf/terminal" 10 ) 11 12 type FakeUI struct { 13 PrintPaginatorStub func(rows []string, err error) 14 printPaginatorMutex sync.RWMutex 15 printPaginatorArgsForCall []struct { 16 rows []string 17 err error 18 } 19 SayStub func(message string, args ...interface{}) 20 sayMutex sync.RWMutex 21 sayArgsForCall []struct { 22 message string 23 args []interface{} 24 } 25 PrintCapturingNoOutputStub func(message string, args ...interface{}) 26 printCapturingNoOutputMutex sync.RWMutex 27 printCapturingNoOutputArgsForCall []struct { 28 message string 29 args []interface{} 30 } 31 WarnStub func(message string, args ...interface{}) 32 warnMutex sync.RWMutex 33 warnArgsForCall []struct { 34 message string 35 args []interface{} 36 } 37 AskStub func(prompt string) (answer string) 38 askMutex sync.RWMutex 39 askArgsForCall []struct { 40 prompt string 41 } 42 askReturns struct { 43 result1 string 44 } 45 AskForPasswordStub func(prompt string) (answer string) 46 askForPasswordMutex sync.RWMutex 47 askForPasswordArgsForCall []struct { 48 prompt string 49 } 50 askForPasswordReturns struct { 51 result1 string 52 } 53 ConfirmStub func(message string) bool 54 confirmMutex sync.RWMutex 55 confirmArgsForCall []struct { 56 message string 57 } 58 confirmReturns struct { 59 result1 bool 60 } 61 ConfirmDeleteStub func(modelType, modelName string) bool 62 confirmDeleteMutex sync.RWMutex 63 confirmDeleteArgsForCall []struct { 64 modelType string 65 modelName string 66 } 67 confirmDeleteReturns struct { 68 result1 bool 69 } 70 ConfirmDeleteWithAssociationsStub func(modelType, modelName string) bool 71 confirmDeleteWithAssociationsMutex sync.RWMutex 72 confirmDeleteWithAssociationsArgsForCall []struct { 73 modelType string 74 modelName string 75 } 76 confirmDeleteWithAssociationsReturns struct { 77 result1 bool 78 } 79 OkStub func() 80 okMutex sync.RWMutex 81 okArgsForCall []struct{} 82 FailedStub func(message string, args ...interface{}) 83 failedMutex sync.RWMutex 84 failedArgsForCall []struct { 85 message string 86 args []interface{} 87 } 88 ShowConfigurationStub func(coreconfig.Reader) error 89 showConfigurationMutex sync.RWMutex 90 showConfigurationArgsForCall []struct { 91 arg1 coreconfig.Reader 92 } 93 showConfigurationReturns struct { 94 result1 error 95 } 96 LoadingIndicationStub func() 97 loadingIndicationMutex sync.RWMutex 98 loadingIndicationArgsForCall []struct{} 99 TableStub func(headers []string) *terminal.UITable 100 tableMutex sync.RWMutex 101 tableArgsForCall []struct { 102 headers []string 103 } 104 tableReturns struct { 105 result1 *terminal.UITable 106 } 107 NotifyUpdateIfNeededStub func(coreconfig.Reader) 108 notifyUpdateIfNeededMutex sync.RWMutex 109 notifyUpdateIfNeededArgsForCall []struct { 110 arg1 coreconfig.Reader 111 } 112 WriterStub func() io.Writer 113 writerMutex sync.RWMutex 114 writerArgsForCall []struct{} 115 writerReturns struct { 116 result1 io.Writer 117 } 118 invocations map[string][][]interface{} 119 invocationsMutex sync.RWMutex 120 } 121 122 func (fake *FakeUI) PrintPaginator(rows []string, err error) { 123 var rowsCopy []string 124 if rows != nil { 125 rowsCopy = make([]string, len(rows)) 126 copy(rowsCopy, rows) 127 } 128 fake.printPaginatorMutex.Lock() 129 fake.printPaginatorArgsForCall = append(fake.printPaginatorArgsForCall, struct { 130 rows []string 131 err error 132 }{rowsCopy, err}) 133 fake.recordInvocation("PrintPaginator", []interface{}{rowsCopy, err}) 134 fake.printPaginatorMutex.Unlock() 135 if fake.PrintPaginatorStub != nil { 136 fake.PrintPaginatorStub(rows, err) 137 } 138 } 139 140 func (fake *FakeUI) PrintPaginatorCallCount() int { 141 fake.printPaginatorMutex.RLock() 142 defer fake.printPaginatorMutex.RUnlock() 143 return len(fake.printPaginatorArgsForCall) 144 } 145 146 func (fake *FakeUI) PrintPaginatorArgsForCall(i int) ([]string, error) { 147 fake.printPaginatorMutex.RLock() 148 defer fake.printPaginatorMutex.RUnlock() 149 return fake.printPaginatorArgsForCall[i].rows, fake.printPaginatorArgsForCall[i].err 150 } 151 152 func (fake *FakeUI) Say(message string, args ...interface{}) { 153 fake.sayMutex.Lock() 154 fake.sayArgsForCall = append(fake.sayArgsForCall, struct { 155 message string 156 args []interface{} 157 }{message, args}) 158 fake.recordInvocation("Say", []interface{}{message, args}) 159 fake.sayMutex.Unlock() 160 if fake.SayStub != nil { 161 fake.SayStub(message, args...) 162 } 163 } 164 165 func (fake *FakeUI) SayCallCount() int { 166 fake.sayMutex.RLock() 167 defer fake.sayMutex.RUnlock() 168 return len(fake.sayArgsForCall) 169 } 170 171 func (fake *FakeUI) SayArgsForCall(i int) (string, []interface{}) { 172 fake.sayMutex.RLock() 173 defer fake.sayMutex.RUnlock() 174 return fake.sayArgsForCall[i].message, fake.sayArgsForCall[i].args 175 } 176 177 func (fake *FakeUI) PrintCapturingNoOutput(message string, args ...interface{}) { 178 fake.printCapturingNoOutputMutex.Lock() 179 fake.printCapturingNoOutputArgsForCall = append(fake.printCapturingNoOutputArgsForCall, struct { 180 message string 181 args []interface{} 182 }{message, args}) 183 fake.recordInvocation("PrintCapturingNoOutput", []interface{}{message, args}) 184 fake.printCapturingNoOutputMutex.Unlock() 185 if fake.PrintCapturingNoOutputStub != nil { 186 fake.PrintCapturingNoOutputStub(message, args...) 187 } 188 } 189 190 func (fake *FakeUI) PrintCapturingNoOutputCallCount() int { 191 fake.printCapturingNoOutputMutex.RLock() 192 defer fake.printCapturingNoOutputMutex.RUnlock() 193 return len(fake.printCapturingNoOutputArgsForCall) 194 } 195 196 func (fake *FakeUI) PrintCapturingNoOutputArgsForCall(i int) (string, []interface{}) { 197 fake.printCapturingNoOutputMutex.RLock() 198 defer fake.printCapturingNoOutputMutex.RUnlock() 199 return fake.printCapturingNoOutputArgsForCall[i].message, fake.printCapturingNoOutputArgsForCall[i].args 200 } 201 202 func (fake *FakeUI) Warn(message string, args ...interface{}) { 203 fake.warnMutex.Lock() 204 fake.warnArgsForCall = append(fake.warnArgsForCall, struct { 205 message string 206 args []interface{} 207 }{message, args}) 208 fake.recordInvocation("Warn", []interface{}{message, args}) 209 fake.warnMutex.Unlock() 210 if fake.WarnStub != nil { 211 fake.WarnStub(message, args...) 212 } 213 } 214 215 func (fake *FakeUI) WarnCallCount() int { 216 fake.warnMutex.RLock() 217 defer fake.warnMutex.RUnlock() 218 return len(fake.warnArgsForCall) 219 } 220 221 func (fake *FakeUI) WarnArgsForCall(i int) (string, []interface{}) { 222 fake.warnMutex.RLock() 223 defer fake.warnMutex.RUnlock() 224 return fake.warnArgsForCall[i].message, fake.warnArgsForCall[i].args 225 } 226 227 func (fake *FakeUI) Ask(prompt string) (answer string) { 228 fake.askMutex.Lock() 229 fake.askArgsForCall = append(fake.askArgsForCall, struct { 230 prompt string 231 }{prompt}) 232 fake.recordInvocation("Ask", []interface{}{prompt}) 233 fake.askMutex.Unlock() 234 if fake.AskStub != nil { 235 return fake.AskStub(prompt) 236 } else { 237 return fake.askReturns.result1 238 } 239 } 240 241 func (fake *FakeUI) AskCallCount() int { 242 fake.askMutex.RLock() 243 defer fake.askMutex.RUnlock() 244 return len(fake.askArgsForCall) 245 } 246 247 func (fake *FakeUI) AskArgsForCall(i int) string { 248 fake.askMutex.RLock() 249 defer fake.askMutex.RUnlock() 250 return fake.askArgsForCall[i].prompt 251 } 252 253 func (fake *FakeUI) AskReturns(result1 string) { 254 fake.AskStub = nil 255 fake.askReturns = struct { 256 result1 string 257 }{result1} 258 } 259 260 func (fake *FakeUI) AskForPassword(prompt string) (answer string) { 261 fake.askForPasswordMutex.Lock() 262 fake.askForPasswordArgsForCall = append(fake.askForPasswordArgsForCall, struct { 263 prompt string 264 }{prompt}) 265 fake.recordInvocation("AskForPassword", []interface{}{prompt}) 266 fake.askForPasswordMutex.Unlock() 267 if fake.AskForPasswordStub != nil { 268 return fake.AskForPasswordStub(prompt) 269 } else { 270 return fake.askForPasswordReturns.result1 271 } 272 } 273 274 func (fake *FakeUI) AskForPasswordCallCount() int { 275 fake.askForPasswordMutex.RLock() 276 defer fake.askForPasswordMutex.RUnlock() 277 return len(fake.askForPasswordArgsForCall) 278 } 279 280 func (fake *FakeUI) AskForPasswordArgsForCall(i int) string { 281 fake.askForPasswordMutex.RLock() 282 defer fake.askForPasswordMutex.RUnlock() 283 return fake.askForPasswordArgsForCall[i].prompt 284 } 285 286 func (fake *FakeUI) AskForPasswordReturns(result1 string) { 287 fake.AskForPasswordStub = nil 288 fake.askForPasswordReturns = struct { 289 result1 string 290 }{result1} 291 } 292 293 func (fake *FakeUI) Confirm(message string) bool { 294 fake.confirmMutex.Lock() 295 fake.confirmArgsForCall = append(fake.confirmArgsForCall, struct { 296 message string 297 }{message}) 298 fake.recordInvocation("Confirm", []interface{}{message}) 299 fake.confirmMutex.Unlock() 300 if fake.ConfirmStub != nil { 301 return fake.ConfirmStub(message) 302 } else { 303 return fake.confirmReturns.result1 304 } 305 } 306 307 func (fake *FakeUI) ConfirmCallCount() int { 308 fake.confirmMutex.RLock() 309 defer fake.confirmMutex.RUnlock() 310 return len(fake.confirmArgsForCall) 311 } 312 313 func (fake *FakeUI) ConfirmArgsForCall(i int) string { 314 fake.confirmMutex.RLock() 315 defer fake.confirmMutex.RUnlock() 316 return fake.confirmArgsForCall[i].message 317 } 318 319 func (fake *FakeUI) ConfirmReturns(result1 bool) { 320 fake.ConfirmStub = nil 321 fake.confirmReturns = struct { 322 result1 bool 323 }{result1} 324 } 325 326 func (fake *FakeUI) ConfirmDelete(modelType string, modelName string) bool { 327 fake.confirmDeleteMutex.Lock() 328 fake.confirmDeleteArgsForCall = append(fake.confirmDeleteArgsForCall, struct { 329 modelType string 330 modelName string 331 }{modelType, modelName}) 332 fake.recordInvocation("ConfirmDelete", []interface{}{modelType, modelName}) 333 fake.confirmDeleteMutex.Unlock() 334 if fake.ConfirmDeleteStub != nil { 335 return fake.ConfirmDeleteStub(modelType, modelName) 336 } else { 337 return fake.confirmDeleteReturns.result1 338 } 339 } 340 341 func (fake *FakeUI) ConfirmDeleteCallCount() int { 342 fake.confirmDeleteMutex.RLock() 343 defer fake.confirmDeleteMutex.RUnlock() 344 return len(fake.confirmDeleteArgsForCall) 345 } 346 347 func (fake *FakeUI) ConfirmDeleteArgsForCall(i int) (string, string) { 348 fake.confirmDeleteMutex.RLock() 349 defer fake.confirmDeleteMutex.RUnlock() 350 return fake.confirmDeleteArgsForCall[i].modelType, fake.confirmDeleteArgsForCall[i].modelName 351 } 352 353 func (fake *FakeUI) ConfirmDeleteReturns(result1 bool) { 354 fake.ConfirmDeleteStub = nil 355 fake.confirmDeleteReturns = struct { 356 result1 bool 357 }{result1} 358 } 359 360 func (fake *FakeUI) ConfirmDeleteWithAssociations(modelType string, modelName string) bool { 361 fake.confirmDeleteWithAssociationsMutex.Lock() 362 fake.confirmDeleteWithAssociationsArgsForCall = append(fake.confirmDeleteWithAssociationsArgsForCall, struct { 363 modelType string 364 modelName string 365 }{modelType, modelName}) 366 fake.recordInvocation("ConfirmDeleteWithAssociations", []interface{}{modelType, modelName}) 367 fake.confirmDeleteWithAssociationsMutex.Unlock() 368 if fake.ConfirmDeleteWithAssociationsStub != nil { 369 return fake.ConfirmDeleteWithAssociationsStub(modelType, modelName) 370 } else { 371 return fake.confirmDeleteWithAssociationsReturns.result1 372 } 373 } 374 375 func (fake *FakeUI) ConfirmDeleteWithAssociationsCallCount() int { 376 fake.confirmDeleteWithAssociationsMutex.RLock() 377 defer fake.confirmDeleteWithAssociationsMutex.RUnlock() 378 return len(fake.confirmDeleteWithAssociationsArgsForCall) 379 } 380 381 func (fake *FakeUI) ConfirmDeleteWithAssociationsArgsForCall(i int) (string, string) { 382 fake.confirmDeleteWithAssociationsMutex.RLock() 383 defer fake.confirmDeleteWithAssociationsMutex.RUnlock() 384 return fake.confirmDeleteWithAssociationsArgsForCall[i].modelType, fake.confirmDeleteWithAssociationsArgsForCall[i].modelName 385 } 386 387 func (fake *FakeUI) ConfirmDeleteWithAssociationsReturns(result1 bool) { 388 fake.ConfirmDeleteWithAssociationsStub = nil 389 fake.confirmDeleteWithAssociationsReturns = struct { 390 result1 bool 391 }{result1} 392 } 393 394 func (fake *FakeUI) Ok() { 395 fake.okMutex.Lock() 396 fake.okArgsForCall = append(fake.okArgsForCall, struct{}{}) 397 fake.recordInvocation("Ok", []interface{}{}) 398 fake.okMutex.Unlock() 399 if fake.OkStub != nil { 400 fake.OkStub() 401 } 402 } 403 404 func (fake *FakeUI) OkCallCount() int { 405 fake.okMutex.RLock() 406 defer fake.okMutex.RUnlock() 407 return len(fake.okArgsForCall) 408 } 409 410 func (fake *FakeUI) Failed(message string, args ...interface{}) { 411 fake.failedMutex.Lock() 412 fake.failedArgsForCall = append(fake.failedArgsForCall, struct { 413 message string 414 args []interface{} 415 }{message, args}) 416 fake.recordInvocation("Failed", []interface{}{message, args}) 417 fake.failedMutex.Unlock() 418 if fake.FailedStub != nil { 419 fake.FailedStub(message, args...) 420 } 421 } 422 423 func (fake *FakeUI) FailedCallCount() int { 424 fake.failedMutex.RLock() 425 defer fake.failedMutex.RUnlock() 426 return len(fake.failedArgsForCall) 427 } 428 429 func (fake *FakeUI) FailedArgsForCall(i int) (string, []interface{}) { 430 fake.failedMutex.RLock() 431 defer fake.failedMutex.RUnlock() 432 return fake.failedArgsForCall[i].message, fake.failedArgsForCall[i].args 433 } 434 435 func (fake *FakeUI) ShowConfiguration(arg1 coreconfig.Reader) error { 436 fake.showConfigurationMutex.Lock() 437 fake.showConfigurationArgsForCall = append(fake.showConfigurationArgsForCall, struct { 438 arg1 coreconfig.Reader 439 }{arg1}) 440 fake.recordInvocation("ShowConfiguration", []interface{}{arg1}) 441 fake.showConfigurationMutex.Unlock() 442 if fake.ShowConfigurationStub != nil { 443 return fake.ShowConfigurationStub(arg1) 444 } else { 445 return fake.showConfigurationReturns.result1 446 } 447 } 448 449 func (fake *FakeUI) ShowConfigurationCallCount() int { 450 fake.showConfigurationMutex.RLock() 451 defer fake.showConfigurationMutex.RUnlock() 452 return len(fake.showConfigurationArgsForCall) 453 } 454 455 func (fake *FakeUI) ShowConfigurationArgsForCall(i int) coreconfig.Reader { 456 fake.showConfigurationMutex.RLock() 457 defer fake.showConfigurationMutex.RUnlock() 458 return fake.showConfigurationArgsForCall[i].arg1 459 } 460 461 func (fake *FakeUI) ShowConfigurationReturns(result1 error) { 462 fake.ShowConfigurationStub = nil 463 fake.showConfigurationReturns = struct { 464 result1 error 465 }{result1} 466 } 467 468 func (fake *FakeUI) LoadingIndication() { 469 fake.loadingIndicationMutex.Lock() 470 fake.loadingIndicationArgsForCall = append(fake.loadingIndicationArgsForCall, struct{}{}) 471 fake.recordInvocation("LoadingIndication", []interface{}{}) 472 fake.loadingIndicationMutex.Unlock() 473 if fake.LoadingIndicationStub != nil { 474 fake.LoadingIndicationStub() 475 } 476 } 477 478 func (fake *FakeUI) LoadingIndicationCallCount() int { 479 fake.loadingIndicationMutex.RLock() 480 defer fake.loadingIndicationMutex.RUnlock() 481 return len(fake.loadingIndicationArgsForCall) 482 } 483 484 func (fake *FakeUI) Table(headers []string) *terminal.UITable { 485 var headersCopy []string 486 if headers != nil { 487 headersCopy = make([]string, len(headers)) 488 copy(headersCopy, headers) 489 } 490 fake.tableMutex.Lock() 491 fake.tableArgsForCall = append(fake.tableArgsForCall, struct { 492 headers []string 493 }{headersCopy}) 494 fake.recordInvocation("Table", []interface{}{headersCopy}) 495 fake.tableMutex.Unlock() 496 if fake.TableStub != nil { 497 return fake.TableStub(headers) 498 } else { 499 return fake.tableReturns.result1 500 } 501 } 502 503 func (fake *FakeUI) TableCallCount() int { 504 fake.tableMutex.RLock() 505 defer fake.tableMutex.RUnlock() 506 return len(fake.tableArgsForCall) 507 } 508 509 func (fake *FakeUI) TableArgsForCall(i int) []string { 510 fake.tableMutex.RLock() 511 defer fake.tableMutex.RUnlock() 512 return fake.tableArgsForCall[i].headers 513 } 514 515 func (fake *FakeUI) TableReturns(result1 *terminal.UITable) { 516 fake.TableStub = nil 517 fake.tableReturns = struct { 518 result1 *terminal.UITable 519 }{result1} 520 } 521 522 func (fake *FakeUI) NotifyUpdateIfNeeded(arg1 coreconfig.Reader) { 523 fake.notifyUpdateIfNeededMutex.Lock() 524 fake.notifyUpdateIfNeededArgsForCall = append(fake.notifyUpdateIfNeededArgsForCall, struct { 525 arg1 coreconfig.Reader 526 }{arg1}) 527 fake.recordInvocation("NotifyUpdateIfNeeded", []interface{}{arg1}) 528 fake.notifyUpdateIfNeededMutex.Unlock() 529 if fake.NotifyUpdateIfNeededStub != nil { 530 fake.NotifyUpdateIfNeededStub(arg1) 531 } 532 } 533 534 func (fake *FakeUI) NotifyUpdateIfNeededCallCount() int { 535 fake.notifyUpdateIfNeededMutex.RLock() 536 defer fake.notifyUpdateIfNeededMutex.RUnlock() 537 return len(fake.notifyUpdateIfNeededArgsForCall) 538 } 539 540 func (fake *FakeUI) NotifyUpdateIfNeededArgsForCall(i int) coreconfig.Reader { 541 fake.notifyUpdateIfNeededMutex.RLock() 542 defer fake.notifyUpdateIfNeededMutex.RUnlock() 543 return fake.notifyUpdateIfNeededArgsForCall[i].arg1 544 } 545 546 func (fake *FakeUI) Writer() io.Writer { 547 fake.writerMutex.Lock() 548 fake.writerArgsForCall = append(fake.writerArgsForCall, struct{}{}) 549 fake.recordInvocation("Writer", []interface{}{}) 550 fake.writerMutex.Unlock() 551 if fake.WriterStub != nil { 552 return fake.WriterStub() 553 } else { 554 return fake.writerReturns.result1 555 } 556 } 557 558 func (fake *FakeUI) WriterCallCount() int { 559 fake.writerMutex.RLock() 560 defer fake.writerMutex.RUnlock() 561 return len(fake.writerArgsForCall) 562 } 563 564 func (fake *FakeUI) WriterReturns(result1 io.Writer) { 565 fake.WriterStub = nil 566 fake.writerReturns = struct { 567 result1 io.Writer 568 }{result1} 569 } 570 571 func (fake *FakeUI) Invocations() map[string][][]interface{} { 572 fake.invocationsMutex.RLock() 573 defer fake.invocationsMutex.RUnlock() 574 fake.printPaginatorMutex.RLock() 575 defer fake.printPaginatorMutex.RUnlock() 576 fake.sayMutex.RLock() 577 defer fake.sayMutex.RUnlock() 578 fake.printCapturingNoOutputMutex.RLock() 579 defer fake.printCapturingNoOutputMutex.RUnlock() 580 fake.warnMutex.RLock() 581 defer fake.warnMutex.RUnlock() 582 fake.askMutex.RLock() 583 defer fake.askMutex.RUnlock() 584 fake.askForPasswordMutex.RLock() 585 defer fake.askForPasswordMutex.RUnlock() 586 fake.confirmMutex.RLock() 587 defer fake.confirmMutex.RUnlock() 588 fake.confirmDeleteMutex.RLock() 589 defer fake.confirmDeleteMutex.RUnlock() 590 fake.confirmDeleteWithAssociationsMutex.RLock() 591 defer fake.confirmDeleteWithAssociationsMutex.RUnlock() 592 fake.okMutex.RLock() 593 defer fake.okMutex.RUnlock() 594 fake.failedMutex.RLock() 595 defer fake.failedMutex.RUnlock() 596 fake.showConfigurationMutex.RLock() 597 defer fake.showConfigurationMutex.RUnlock() 598 fake.loadingIndicationMutex.RLock() 599 defer fake.loadingIndicationMutex.RUnlock() 600 fake.tableMutex.RLock() 601 defer fake.tableMutex.RUnlock() 602 fake.notifyUpdateIfNeededMutex.RLock() 603 defer fake.notifyUpdateIfNeededMutex.RUnlock() 604 fake.writerMutex.RLock() 605 defer fake.writerMutex.RUnlock() 606 return fake.invocations 607 } 608 609 func (fake *FakeUI) recordInvocation(key string, args []interface{}) { 610 fake.invocationsMutex.Lock() 611 defer fake.invocationsMutex.Unlock() 612 if fake.invocations == nil { 613 fake.invocations = map[string][][]interface{}{} 614 } 615 if fake.invocations[key] == nil { 616 fake.invocations[key] = [][]interface{}{} 617 } 618 fake.invocations[key] = append(fake.invocations[key], args) 619 } 620 621 var _ terminal.UI = new(FakeUI)