github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/orderer/common/follower/mocks/time_after.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mocks 3 4 import ( 5 "sync" 6 "time" 7 ) 8 9 type TimeAfter struct { 10 AfterStub func(time.Duration) <-chan time.Time 11 afterMutex sync.RWMutex 12 afterArgsForCall []struct { 13 arg1 time.Duration 14 } 15 afterReturns struct { 16 result1 <-chan time.Time 17 } 18 afterReturnsOnCall map[int]struct { 19 result1 <-chan time.Time 20 } 21 invocations map[string][][]interface{} 22 invocationsMutex sync.RWMutex 23 } 24 25 func (fake *TimeAfter) After(arg1 time.Duration) <-chan time.Time { 26 fake.afterMutex.Lock() 27 ret, specificReturn := fake.afterReturnsOnCall[len(fake.afterArgsForCall)] 28 fake.afterArgsForCall = append(fake.afterArgsForCall, struct { 29 arg1 time.Duration 30 }{arg1}) 31 fake.recordInvocation("After", []interface{}{arg1}) 32 fake.afterMutex.Unlock() 33 if fake.AfterStub != nil { 34 return fake.AfterStub(arg1) 35 } 36 if specificReturn { 37 return ret.result1 38 } 39 fakeReturns := fake.afterReturns 40 return fakeReturns.result1 41 } 42 43 func (fake *TimeAfter) AfterCallCount() int { 44 fake.afterMutex.RLock() 45 defer fake.afterMutex.RUnlock() 46 return len(fake.afterArgsForCall) 47 } 48 49 func (fake *TimeAfter) AfterCalls(stub func(time.Duration) <-chan time.Time) { 50 fake.afterMutex.Lock() 51 defer fake.afterMutex.Unlock() 52 fake.AfterStub = stub 53 } 54 55 func (fake *TimeAfter) AfterArgsForCall(i int) time.Duration { 56 fake.afterMutex.RLock() 57 defer fake.afterMutex.RUnlock() 58 argsForCall := fake.afterArgsForCall[i] 59 return argsForCall.arg1 60 } 61 62 func (fake *TimeAfter) AfterReturns(result1 <-chan time.Time) { 63 fake.afterMutex.Lock() 64 defer fake.afterMutex.Unlock() 65 fake.AfterStub = nil 66 fake.afterReturns = struct { 67 result1 <-chan time.Time 68 }{result1} 69 } 70 71 func (fake *TimeAfter) AfterReturnsOnCall(i int, result1 <-chan time.Time) { 72 fake.afterMutex.Lock() 73 defer fake.afterMutex.Unlock() 74 fake.AfterStub = nil 75 if fake.afterReturnsOnCall == nil { 76 fake.afterReturnsOnCall = make(map[int]struct { 77 result1 <-chan time.Time 78 }) 79 } 80 fake.afterReturnsOnCall[i] = struct { 81 result1 <-chan time.Time 82 }{result1} 83 } 84 85 func (fake *TimeAfter) Invocations() map[string][][]interface{} { 86 fake.invocationsMutex.RLock() 87 defer fake.invocationsMutex.RUnlock() 88 fake.afterMutex.RLock() 89 defer fake.afterMutex.RUnlock() 90 copiedInvocations := map[string][][]interface{}{} 91 for key, value := range fake.invocations { 92 copiedInvocations[key] = value 93 } 94 return copiedInvocations 95 } 96 97 func (fake *TimeAfter) recordInvocation(key string, args []interface{}) { 98 fake.invocationsMutex.Lock() 99 defer fake.invocationsMutex.Unlock() 100 if fake.invocations == nil { 101 fake.invocations = map[string][][]interface{}{} 102 } 103 if fake.invocations[key] == nil { 104 fake.invocations[key] = [][]interface{}{} 105 } 106 fake.invocations[key] = append(fake.invocations[key], args) 107 }