github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/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 stub := fake.ExitStub 26 fake.recordInvocation("Exit", []interface{}{arg1}) 27 fake.exitMutex.Unlock() 28 if stub != nil { 29 fake.ExitStub(arg1) 30 } 31 } 32 33 func (fake *FakeExiter) ExitCallCount() int { 34 fake.exitMutex.RLock() 35 defer fake.exitMutex.RUnlock() 36 return len(fake.exitArgsForCall) 37 } 38 39 func (fake *FakeExiter) ExitCalls(stub func(int)) { 40 fake.exitMutex.Lock() 41 defer fake.exitMutex.Unlock() 42 fake.ExitStub = stub 43 } 44 45 func (fake *FakeExiter) ExitArgsForCall(i int) int { 46 fake.exitMutex.RLock() 47 defer fake.exitMutex.RUnlock() 48 argsForCall := fake.exitArgsForCall[i] 49 return argsForCall.arg1 50 } 51 52 func (fake *FakeExiter) Invocations() map[string][][]interface{} { 53 fake.invocationsMutex.RLock() 54 defer fake.invocationsMutex.RUnlock() 55 fake.exitMutex.RLock() 56 defer fake.exitMutex.RUnlock() 57 copiedInvocations := map[string][][]interface{}{} 58 for key, value := range fake.invocations { 59 copiedInvocations[key] = value 60 } 61 return copiedInvocations 62 } 63 64 func (fake *FakeExiter) recordInvocation(key string, args []interface{}) { 65 fake.invocationsMutex.Lock() 66 defer fake.invocationsMutex.Unlock() 67 if fake.invocations == nil { 68 fake.invocations = map[string][][]interface{}{} 69 } 70 if fake.invocations[key] == nil { 71 fake.invocations[key] = [][]interface{}{} 72 } 73 fake.invocations[key] = append(fake.invocations[key], args) 74 } 75 76 var _ ui.Exiter = new(FakeExiter)