github.com/ewagmig/fabric@v2.1.1+incompatible/common/deliver/mock/inspector.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "context" 6 "sync" 7 8 "github.com/golang/protobuf/proto" 9 "github.com/hyperledger/fabric/common/deliver" 10 ) 11 12 type Inspector struct { 13 InspectStub func(context.Context, proto.Message) error 14 inspectMutex sync.RWMutex 15 inspectArgsForCall []struct { 16 arg1 context.Context 17 arg2 proto.Message 18 } 19 inspectReturns struct { 20 result1 error 21 } 22 inspectReturnsOnCall map[int]struct { 23 result1 error 24 } 25 invocations map[string][][]interface{} 26 invocationsMutex sync.RWMutex 27 } 28 29 func (fake *Inspector) Inspect(arg1 context.Context, arg2 proto.Message) error { 30 fake.inspectMutex.Lock() 31 ret, specificReturn := fake.inspectReturnsOnCall[len(fake.inspectArgsForCall)] 32 fake.inspectArgsForCall = append(fake.inspectArgsForCall, struct { 33 arg1 context.Context 34 arg2 proto.Message 35 }{arg1, arg2}) 36 fake.recordInvocation("Inspect", []interface{}{arg1, arg2}) 37 fake.inspectMutex.Unlock() 38 if fake.InspectStub != nil { 39 return fake.InspectStub(arg1, arg2) 40 } 41 if specificReturn { 42 return ret.result1 43 } 44 fakeReturns := fake.inspectReturns 45 return fakeReturns.result1 46 } 47 48 func (fake *Inspector) InspectCallCount() int { 49 fake.inspectMutex.RLock() 50 defer fake.inspectMutex.RUnlock() 51 return len(fake.inspectArgsForCall) 52 } 53 54 func (fake *Inspector) InspectCalls(stub func(context.Context, proto.Message) error) { 55 fake.inspectMutex.Lock() 56 defer fake.inspectMutex.Unlock() 57 fake.InspectStub = stub 58 } 59 60 func (fake *Inspector) InspectArgsForCall(i int) (context.Context, proto.Message) { 61 fake.inspectMutex.RLock() 62 defer fake.inspectMutex.RUnlock() 63 argsForCall := fake.inspectArgsForCall[i] 64 return argsForCall.arg1, argsForCall.arg2 65 } 66 67 func (fake *Inspector) InspectReturns(result1 error) { 68 fake.inspectMutex.Lock() 69 defer fake.inspectMutex.Unlock() 70 fake.InspectStub = nil 71 fake.inspectReturns = struct { 72 result1 error 73 }{result1} 74 } 75 76 func (fake *Inspector) InspectReturnsOnCall(i int, result1 error) { 77 fake.inspectMutex.Lock() 78 defer fake.inspectMutex.Unlock() 79 fake.InspectStub = nil 80 if fake.inspectReturnsOnCall == nil { 81 fake.inspectReturnsOnCall = make(map[int]struct { 82 result1 error 83 }) 84 } 85 fake.inspectReturnsOnCall[i] = struct { 86 result1 error 87 }{result1} 88 } 89 90 func (fake *Inspector) Invocations() map[string][][]interface{} { 91 fake.invocationsMutex.RLock() 92 defer fake.invocationsMutex.RUnlock() 93 fake.inspectMutex.RLock() 94 defer fake.inspectMutex.RUnlock() 95 copiedInvocations := map[string][][]interface{}{} 96 for key, value := range fake.invocations { 97 copiedInvocations[key] = value 98 } 99 return copiedInvocations 100 } 101 102 func (fake *Inspector) recordInvocation(key string, args []interface{}) { 103 fake.invocationsMutex.Lock() 104 defer fake.invocationsMutex.Unlock() 105 if fake.invocations == nil { 106 fake.invocations = map[string][][]interface{}{} 107 } 108 if fake.invocations[key] == nil { 109 fake.invocations[key] = [][]interface{}{} 110 } 111 fake.invocations[key] = append(fake.invocations[key], args) 112 } 113 114 var _ deliver.Inspector = new(Inspector)