github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/util/ui/uifakes/fake_interactor.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package uifakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/util/ui" 8 "github.com/vito/go-interact/interact" 9 ) 10 11 type FakeInteractor struct { 12 NewInteractionStub func(string, ...interact.Choice) ui.Resolver 13 newInteractionMutex sync.RWMutex 14 newInteractionArgsForCall []struct { 15 arg1 string 16 arg2 []interact.Choice 17 } 18 newInteractionReturns struct { 19 result1 ui.Resolver 20 } 21 newInteractionReturnsOnCall map[int]struct { 22 result1 ui.Resolver 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *FakeInteractor) NewInteraction(arg1 string, arg2 ...interact.Choice) ui.Resolver { 29 fake.newInteractionMutex.Lock() 30 ret, specificReturn := fake.newInteractionReturnsOnCall[len(fake.newInteractionArgsForCall)] 31 fake.newInteractionArgsForCall = append(fake.newInteractionArgsForCall, struct { 32 arg1 string 33 arg2 []interact.Choice 34 }{arg1, arg2}) 35 fake.recordInvocation("NewInteraction", []interface{}{arg1, arg2}) 36 fake.newInteractionMutex.Unlock() 37 if fake.NewInteractionStub != nil { 38 return fake.NewInteractionStub(arg1, arg2...) 39 } 40 if specificReturn { 41 return ret.result1 42 } 43 fakeReturns := fake.newInteractionReturns 44 return fakeReturns.result1 45 } 46 47 func (fake *FakeInteractor) NewInteractionCallCount() int { 48 fake.newInteractionMutex.RLock() 49 defer fake.newInteractionMutex.RUnlock() 50 return len(fake.newInteractionArgsForCall) 51 } 52 53 func (fake *FakeInteractor) NewInteractionCalls(stub func(string, ...interact.Choice) ui.Resolver) { 54 fake.newInteractionMutex.Lock() 55 defer fake.newInteractionMutex.Unlock() 56 fake.NewInteractionStub = stub 57 } 58 59 func (fake *FakeInteractor) NewInteractionArgsForCall(i int) (string, []interact.Choice) { 60 fake.newInteractionMutex.RLock() 61 defer fake.newInteractionMutex.RUnlock() 62 argsForCall := fake.newInteractionArgsForCall[i] 63 return argsForCall.arg1, argsForCall.arg2 64 } 65 66 func (fake *FakeInteractor) NewInteractionReturns(result1 ui.Resolver) { 67 fake.newInteractionMutex.Lock() 68 defer fake.newInteractionMutex.Unlock() 69 fake.NewInteractionStub = nil 70 fake.newInteractionReturns = struct { 71 result1 ui.Resolver 72 }{result1} 73 } 74 75 func (fake *FakeInteractor) NewInteractionReturnsOnCall(i int, result1 ui.Resolver) { 76 fake.newInteractionMutex.Lock() 77 defer fake.newInteractionMutex.Unlock() 78 fake.NewInteractionStub = nil 79 if fake.newInteractionReturnsOnCall == nil { 80 fake.newInteractionReturnsOnCall = make(map[int]struct { 81 result1 ui.Resolver 82 }) 83 } 84 fake.newInteractionReturnsOnCall[i] = struct { 85 result1 ui.Resolver 86 }{result1} 87 } 88 89 func (fake *FakeInteractor) Invocations() map[string][][]interface{} { 90 fake.invocationsMutex.RLock() 91 defer fake.invocationsMutex.RUnlock() 92 fake.newInteractionMutex.RLock() 93 defer fake.newInteractionMutex.RUnlock() 94 copiedInvocations := map[string][][]interface{}{} 95 for key, value := range fake.invocations { 96 copiedInvocations[key] = value 97 } 98 return copiedInvocations 99 } 100 101 func (fake *FakeInteractor) recordInvocation(key string, args []interface{}) { 102 fake.invocationsMutex.Lock() 103 defer fake.invocationsMutex.Unlock() 104 if fake.invocations == nil { 105 fake.invocations = map[string][][]interface{}{} 106 } 107 if fake.invocations[key] == nil { 108 fake.invocations[key] = [][]interface{}{} 109 } 110 fake.invocations[key] = append(fake.invocations[key], args) 111 } 112 113 var _ ui.Interactor = new(FakeInteractor)