github.com/chenbh/concourse/v6@v6.4.2/atc/lidar/lidarfakes/fake_checkable_counter.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package lidarfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/chenbh/concourse/v6/atc/lidar"
     8  )
     9  
    10  type FakeCheckableCounter struct {
    11  	CheckableCountStub        func() (int, error)
    12  	checkableCountMutex       sync.RWMutex
    13  	checkableCountArgsForCall []struct {
    14  	}
    15  	checkableCountReturns struct {
    16  		result1 int
    17  		result2 error
    18  	}
    19  	checkableCountReturnsOnCall map[int]struct {
    20  		result1 int
    21  		result2 error
    22  	}
    23  	invocations      map[string][][]interface{}
    24  	invocationsMutex sync.RWMutex
    25  }
    26  
    27  func (fake *FakeCheckableCounter) CheckableCount() (int, error) {
    28  	fake.checkableCountMutex.Lock()
    29  	ret, specificReturn := fake.checkableCountReturnsOnCall[len(fake.checkableCountArgsForCall)]
    30  	fake.checkableCountArgsForCall = append(fake.checkableCountArgsForCall, struct {
    31  	}{})
    32  	fake.recordInvocation("CheckableCount", []interface{}{})
    33  	fake.checkableCountMutex.Unlock()
    34  	if fake.CheckableCountStub != nil {
    35  		return fake.CheckableCountStub()
    36  	}
    37  	if specificReturn {
    38  		return ret.result1, ret.result2
    39  	}
    40  	fakeReturns := fake.checkableCountReturns
    41  	return fakeReturns.result1, fakeReturns.result2
    42  }
    43  
    44  func (fake *FakeCheckableCounter) CheckableCountCallCount() int {
    45  	fake.checkableCountMutex.RLock()
    46  	defer fake.checkableCountMutex.RUnlock()
    47  	return len(fake.checkableCountArgsForCall)
    48  }
    49  
    50  func (fake *FakeCheckableCounter) CheckableCountCalls(stub func() (int, error)) {
    51  	fake.checkableCountMutex.Lock()
    52  	defer fake.checkableCountMutex.Unlock()
    53  	fake.CheckableCountStub = stub
    54  }
    55  
    56  func (fake *FakeCheckableCounter) CheckableCountReturns(result1 int, result2 error) {
    57  	fake.checkableCountMutex.Lock()
    58  	defer fake.checkableCountMutex.Unlock()
    59  	fake.CheckableCountStub = nil
    60  	fake.checkableCountReturns = struct {
    61  		result1 int
    62  		result2 error
    63  	}{result1, result2}
    64  }
    65  
    66  func (fake *FakeCheckableCounter) CheckableCountReturnsOnCall(i int, result1 int, result2 error) {
    67  	fake.checkableCountMutex.Lock()
    68  	defer fake.checkableCountMutex.Unlock()
    69  	fake.CheckableCountStub = nil
    70  	if fake.checkableCountReturnsOnCall == nil {
    71  		fake.checkableCountReturnsOnCall = make(map[int]struct {
    72  			result1 int
    73  			result2 error
    74  		})
    75  	}
    76  	fake.checkableCountReturnsOnCall[i] = struct {
    77  		result1 int
    78  		result2 error
    79  	}{result1, result2}
    80  }
    81  
    82  func (fake *FakeCheckableCounter) Invocations() map[string][][]interface{} {
    83  	fake.invocationsMutex.RLock()
    84  	defer fake.invocationsMutex.RUnlock()
    85  	fake.checkableCountMutex.RLock()
    86  	defer fake.checkableCountMutex.RUnlock()
    87  	copiedInvocations := map[string][][]interface{}{}
    88  	for key, value := range fake.invocations {
    89  		copiedInvocations[key] = value
    90  	}
    91  	return copiedInvocations
    92  }
    93  
    94  func (fake *FakeCheckableCounter) recordInvocation(key string, args []interface{}) {
    95  	fake.invocationsMutex.Lock()
    96  	defer fake.invocationsMutex.Unlock()
    97  	if fake.invocations == nil {
    98  		fake.invocations = map[string][][]interface{}{}
    99  	}
   100  	if fake.invocations[key] == nil {
   101  		fake.invocations[key] = [][]interface{}{}
   102  	}
   103  	fake.invocations[key] = append(fake.invocations[key], args)
   104  }
   105  
   106  var _ lidar.CheckableCounter = new(FakeCheckableCounter)