github.com/cloudfoundry/cli@v7.1.0+incompatible/util/ui/uifakes/fake_exiter.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 ) 9 10 type FakeExiter struct { 11 ExitStub func(int) 12 exitMutex sync.RWMutex 13 exitArgsForCall []struct { 14 arg1 int 15 } 16 invocations map[string][][]interface{} 17 invocationsMutex sync.RWMutex 18 } 19 20 func (fake *FakeExiter) Exit(arg1 int) { 21 fake.exitMutex.Lock() 22 fake.exitArgsForCall = append(fake.exitArgsForCall, struct { 23 arg1 int 24 }{arg1}) 25 fake.recordInvocation("Exit", []interface{}{arg1}) 26 fake.exitMutex.Unlock() 27 if fake.ExitStub != nil { 28 fake.ExitStub(arg1) 29 } 30 } 31 32 func (fake *FakeExiter) ExitCallCount() int { 33 fake.exitMutex.RLock() 34 defer fake.exitMutex.RUnlock() 35 return len(fake.exitArgsForCall) 36 } 37 38 func (fake *FakeExiter) ExitCalls(stub func(int)) { 39 fake.exitMutex.Lock() 40 defer fake.exitMutex.Unlock() 41 fake.ExitStub = stub 42 } 43 44 func (fake *FakeExiter) ExitArgsForCall(i int) int { 45 fake.exitMutex.RLock() 46 defer fake.exitMutex.RUnlock() 47 argsForCall := fake.exitArgsForCall[i] 48 return argsForCall.arg1 49 } 50 51 func (fake *FakeExiter) Invocations() map[string][][]interface{} { 52 fake.invocationsMutex.RLock() 53 defer fake.invocationsMutex.RUnlock() 54 fake.exitMutex.RLock() 55 defer fake.exitMutex.RUnlock() 56 copiedInvocations := map[string][][]interface{}{} 57 for key, value := range fake.invocations { 58 copiedInvocations[key] = value 59 } 60 return copiedInvocations 61 } 62 63 func (fake *FakeExiter) recordInvocation(key string, args []interface{}) { 64 fake.invocationsMutex.Lock() 65 defer fake.invocationsMutex.Unlock() 66 if fake.invocations == nil { 67 fake.invocations = map[string][][]interface{}{} 68 } 69 if fake.invocations[key] == nil { 70 fake.invocations[key] = [][]interface{}{} 71 } 72 fake.invocations[key] = append(fake.invocations[key], args) 73 } 74 75 var _ ui.Exiter = new(FakeExiter)