github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/core/dispatcher/mock/protobuf.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mock
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/golang/protobuf/proto"
     8  )
     9  
    10  type Protobuf struct {
    11  	MarshalStub        func(proto.Message) ([]byte, error)
    12  	marshalMutex       sync.RWMutex
    13  	marshalArgsForCall []struct {
    14  		arg1 proto.Message
    15  	}
    16  	marshalReturns struct {
    17  		result1 []byte
    18  		result2 error
    19  	}
    20  	marshalReturnsOnCall map[int]struct {
    21  		result1 []byte
    22  		result2 error
    23  	}
    24  	UnmarshalStub        func([]byte, proto.Message) error
    25  	unmarshalMutex       sync.RWMutex
    26  	unmarshalArgsForCall []struct {
    27  		arg1 []byte
    28  		arg2 proto.Message
    29  	}
    30  	unmarshalReturns struct {
    31  		result1 error
    32  	}
    33  	unmarshalReturnsOnCall map[int]struct {
    34  		result1 error
    35  	}
    36  	invocations      map[string][][]interface{}
    37  	invocationsMutex sync.RWMutex
    38  }
    39  
    40  func (fake *Protobuf) Marshal(arg1 proto.Message) ([]byte, error) {
    41  	fake.marshalMutex.Lock()
    42  	ret, specificReturn := fake.marshalReturnsOnCall[len(fake.marshalArgsForCall)]
    43  	fake.marshalArgsForCall = append(fake.marshalArgsForCall, struct {
    44  		arg1 proto.Message
    45  	}{arg1})
    46  	fake.recordInvocation("Marshal", []interface{}{arg1})
    47  	fake.marshalMutex.Unlock()
    48  	if fake.MarshalStub != nil {
    49  		return fake.MarshalStub(arg1)
    50  	}
    51  	if specificReturn {
    52  		return ret.result1, ret.result2
    53  	}
    54  	fakeReturns := fake.marshalReturns
    55  	return fakeReturns.result1, fakeReturns.result2
    56  }
    57  
    58  func (fake *Protobuf) MarshalCallCount() int {
    59  	fake.marshalMutex.RLock()
    60  	defer fake.marshalMutex.RUnlock()
    61  	return len(fake.marshalArgsForCall)
    62  }
    63  
    64  func (fake *Protobuf) MarshalCalls(stub func(proto.Message) ([]byte, error)) {
    65  	fake.marshalMutex.Lock()
    66  	defer fake.marshalMutex.Unlock()
    67  	fake.MarshalStub = stub
    68  }
    69  
    70  func (fake *Protobuf) MarshalArgsForCall(i int) proto.Message {
    71  	fake.marshalMutex.RLock()
    72  	defer fake.marshalMutex.RUnlock()
    73  	argsForCall := fake.marshalArgsForCall[i]
    74  	return argsForCall.arg1
    75  }
    76  
    77  func (fake *Protobuf) MarshalReturns(result1 []byte, result2 error) {
    78  	fake.marshalMutex.Lock()
    79  	defer fake.marshalMutex.Unlock()
    80  	fake.MarshalStub = nil
    81  	fake.marshalReturns = struct {
    82  		result1 []byte
    83  		result2 error
    84  	}{result1, result2}
    85  }
    86  
    87  func (fake *Protobuf) MarshalReturnsOnCall(i int, result1 []byte, result2 error) {
    88  	fake.marshalMutex.Lock()
    89  	defer fake.marshalMutex.Unlock()
    90  	fake.MarshalStub = nil
    91  	if fake.marshalReturnsOnCall == nil {
    92  		fake.marshalReturnsOnCall = make(map[int]struct {
    93  			result1 []byte
    94  			result2 error
    95  		})
    96  	}
    97  	fake.marshalReturnsOnCall[i] = struct {
    98  		result1 []byte
    99  		result2 error
   100  	}{result1, result2}
   101  }
   102  
   103  func (fake *Protobuf) Unmarshal(arg1 []byte, arg2 proto.Message) error {
   104  	var arg1Copy []byte
   105  	if arg1 != nil {
   106  		arg1Copy = make([]byte, len(arg1))
   107  		copy(arg1Copy, arg1)
   108  	}
   109  	fake.unmarshalMutex.Lock()
   110  	ret, specificReturn := fake.unmarshalReturnsOnCall[len(fake.unmarshalArgsForCall)]
   111  	fake.unmarshalArgsForCall = append(fake.unmarshalArgsForCall, struct {
   112  		arg1 []byte
   113  		arg2 proto.Message
   114  	}{arg1Copy, arg2})
   115  	fake.recordInvocation("Unmarshal", []interface{}{arg1Copy, arg2})
   116  	fake.unmarshalMutex.Unlock()
   117  	if fake.UnmarshalStub != nil {
   118  		return fake.UnmarshalStub(arg1, arg2)
   119  	}
   120  	if specificReturn {
   121  		return ret.result1
   122  	}
   123  	fakeReturns := fake.unmarshalReturns
   124  	return fakeReturns.result1
   125  }
   126  
   127  func (fake *Protobuf) UnmarshalCallCount() int {
   128  	fake.unmarshalMutex.RLock()
   129  	defer fake.unmarshalMutex.RUnlock()
   130  	return len(fake.unmarshalArgsForCall)
   131  }
   132  
   133  func (fake *Protobuf) UnmarshalCalls(stub func([]byte, proto.Message) error) {
   134  	fake.unmarshalMutex.Lock()
   135  	defer fake.unmarshalMutex.Unlock()
   136  	fake.UnmarshalStub = stub
   137  }
   138  
   139  func (fake *Protobuf) UnmarshalArgsForCall(i int) ([]byte, proto.Message) {
   140  	fake.unmarshalMutex.RLock()
   141  	defer fake.unmarshalMutex.RUnlock()
   142  	argsForCall := fake.unmarshalArgsForCall[i]
   143  	return argsForCall.arg1, argsForCall.arg2
   144  }
   145  
   146  func (fake *Protobuf) UnmarshalReturns(result1 error) {
   147  	fake.unmarshalMutex.Lock()
   148  	defer fake.unmarshalMutex.Unlock()
   149  	fake.UnmarshalStub = nil
   150  	fake.unmarshalReturns = struct {
   151  		result1 error
   152  	}{result1}
   153  }
   154  
   155  func (fake *Protobuf) UnmarshalReturnsOnCall(i int, result1 error) {
   156  	fake.unmarshalMutex.Lock()
   157  	defer fake.unmarshalMutex.Unlock()
   158  	fake.UnmarshalStub = nil
   159  	if fake.unmarshalReturnsOnCall == nil {
   160  		fake.unmarshalReturnsOnCall = make(map[int]struct {
   161  			result1 error
   162  		})
   163  	}
   164  	fake.unmarshalReturnsOnCall[i] = struct {
   165  		result1 error
   166  	}{result1}
   167  }
   168  
   169  func (fake *Protobuf) Invocations() map[string][][]interface{} {
   170  	fake.invocationsMutex.RLock()
   171  	defer fake.invocationsMutex.RUnlock()
   172  	fake.marshalMutex.RLock()
   173  	defer fake.marshalMutex.RUnlock()
   174  	fake.unmarshalMutex.RLock()
   175  	defer fake.unmarshalMutex.RUnlock()
   176  	copiedInvocations := map[string][][]interface{}{}
   177  	for key, value := range fake.invocations {
   178  		copiedInvocations[key] = value
   179  	}
   180  	return copiedInvocations
   181  }
   182  
   183  func (fake *Protobuf) recordInvocation(key string, args []interface{}) {
   184  	fake.invocationsMutex.Lock()
   185  	defer fake.invocationsMutex.Unlock()
   186  	if fake.invocations == nil {
   187  		fake.invocations = map[string][][]interface{}{}
   188  	}
   189  	if fake.invocations[key] == nil {
   190  		fake.invocations[key] = [][]interface{}{}
   191  	}
   192  	fake.invocations[key] = append(fake.invocations[key], args)
   193  }