github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/internal/pkg/gateway/commit/mocks/notificationsupplier.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package mocks
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/hechain20/hechain/core/ledger"
     8  )
     9  
    10  type NotificationSupplier struct {
    11  	CommitNotificationsStub        func(<-chan struct{}, string) (<-chan *ledger.CommitNotification, error)
    12  	commitNotificationsMutex       sync.RWMutex
    13  	commitNotificationsArgsForCall []struct {
    14  		arg1 <-chan struct{}
    15  		arg2 string
    16  	}
    17  	commitNotificationsReturns struct {
    18  		result1 <-chan *ledger.CommitNotification
    19  		result2 error
    20  	}
    21  	commitNotificationsReturnsOnCall map[int]struct {
    22  		result1 <-chan *ledger.CommitNotification
    23  		result2 error
    24  	}
    25  	invocations      map[string][][]interface{}
    26  	invocationsMutex sync.RWMutex
    27  }
    28  
    29  func (fake *NotificationSupplier) CommitNotifications(arg1 <-chan struct{}, arg2 string) (<-chan *ledger.CommitNotification, error) {
    30  	fake.commitNotificationsMutex.Lock()
    31  	ret, specificReturn := fake.commitNotificationsReturnsOnCall[len(fake.commitNotificationsArgsForCall)]
    32  	fake.commitNotificationsArgsForCall = append(fake.commitNotificationsArgsForCall, struct {
    33  		arg1 <-chan struct{}
    34  		arg2 string
    35  	}{arg1, arg2})
    36  	stub := fake.CommitNotificationsStub
    37  	fakeReturns := fake.commitNotificationsReturns
    38  	fake.recordInvocation("CommitNotifications", []interface{}{arg1, arg2})
    39  	fake.commitNotificationsMutex.Unlock()
    40  	if stub != nil {
    41  		return stub(arg1, arg2)
    42  	}
    43  	if specificReturn {
    44  		return ret.result1, ret.result2
    45  	}
    46  	return fakeReturns.result1, fakeReturns.result2
    47  }
    48  
    49  func (fake *NotificationSupplier) CommitNotificationsCallCount() int {
    50  	fake.commitNotificationsMutex.RLock()
    51  	defer fake.commitNotificationsMutex.RUnlock()
    52  	return len(fake.commitNotificationsArgsForCall)
    53  }
    54  
    55  func (fake *NotificationSupplier) CommitNotificationsCalls(stub func(<-chan struct{}, string) (<-chan *ledger.CommitNotification, error)) {
    56  	fake.commitNotificationsMutex.Lock()
    57  	defer fake.commitNotificationsMutex.Unlock()
    58  	fake.CommitNotificationsStub = stub
    59  }
    60  
    61  func (fake *NotificationSupplier) CommitNotificationsArgsForCall(i int) (<-chan struct{}, string) {
    62  	fake.commitNotificationsMutex.RLock()
    63  	defer fake.commitNotificationsMutex.RUnlock()
    64  	argsForCall := fake.commitNotificationsArgsForCall[i]
    65  	return argsForCall.arg1, argsForCall.arg2
    66  }
    67  
    68  func (fake *NotificationSupplier) CommitNotificationsReturns(result1 <-chan *ledger.CommitNotification, result2 error) {
    69  	fake.commitNotificationsMutex.Lock()
    70  	defer fake.commitNotificationsMutex.Unlock()
    71  	fake.CommitNotificationsStub = nil
    72  	fake.commitNotificationsReturns = struct {
    73  		result1 <-chan *ledger.CommitNotification
    74  		result2 error
    75  	}{result1, result2}
    76  }
    77  
    78  func (fake *NotificationSupplier) CommitNotificationsReturnsOnCall(i int, result1 <-chan *ledger.CommitNotification, result2 error) {
    79  	fake.commitNotificationsMutex.Lock()
    80  	defer fake.commitNotificationsMutex.Unlock()
    81  	fake.CommitNotificationsStub = nil
    82  	if fake.commitNotificationsReturnsOnCall == nil {
    83  		fake.commitNotificationsReturnsOnCall = make(map[int]struct {
    84  			result1 <-chan *ledger.CommitNotification
    85  			result2 error
    86  		})
    87  	}
    88  	fake.commitNotificationsReturnsOnCall[i] = struct {
    89  		result1 <-chan *ledger.CommitNotification
    90  		result2 error
    91  	}{result1, result2}
    92  }
    93  
    94  func (fake *NotificationSupplier) Invocations() map[string][][]interface{} {
    95  	fake.invocationsMutex.RLock()
    96  	defer fake.invocationsMutex.RUnlock()
    97  	fake.commitNotificationsMutex.RLock()
    98  	defer fake.commitNotificationsMutex.RUnlock()
    99  	copiedInvocations := map[string][][]interface{}{}
   100  	for key, value := range fake.invocations {
   101  		copiedInvocations[key] = value
   102  	}
   103  	return copiedInvocations
   104  }
   105  
   106  func (fake *NotificationSupplier) recordInvocation(key string, args []interface{}) {
   107  	fake.invocationsMutex.Lock()
   108  	defer fake.invocationsMutex.Unlock()
   109  	if fake.invocations == nil {
   110  		fake.invocations = map[string][][]interface{}{}
   111  	}
   112  	if fake.invocations[key] == nil {
   113  		fake.invocations[key] = [][]interface{}{}
   114  	}
   115  	fake.invocations[key] = append(fake.invocations[key], args)
   116  }