github.com/cloudfoundry-incubator/stembuild@v0.0.0-20211223202937-5b61d62226c6/poller/pollerfakes/fake_poller_i.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package pollerfakes
     3  
     4  import (
     5  	"sync"
     6  	"time"
     7  
     8  	"github.com/cloudfoundry-incubator/stembuild/poller"
     9  )
    10  
    11  type FakePollerI struct {
    12  	PollStub        func(time.Duration, func() (bool, error)) error
    13  	pollMutex       sync.RWMutex
    14  	pollArgsForCall []struct {
    15  		arg1 time.Duration
    16  		arg2 func() (bool, error)
    17  	}
    18  	pollReturns struct {
    19  		result1 error
    20  	}
    21  	pollReturnsOnCall map[int]struct {
    22  		result1 error
    23  	}
    24  	invocations      map[string][][]interface{}
    25  	invocationsMutex sync.RWMutex
    26  }
    27  
    28  func (fake *FakePollerI) Poll(arg1 time.Duration, arg2 func() (bool, error)) error {
    29  	fake.pollMutex.Lock()
    30  	ret, specificReturn := fake.pollReturnsOnCall[len(fake.pollArgsForCall)]
    31  	fake.pollArgsForCall = append(fake.pollArgsForCall, struct {
    32  		arg1 time.Duration
    33  		arg2 func() (bool, error)
    34  	}{arg1, arg2})
    35  	fake.recordInvocation("Poll", []interface{}{arg1, arg2})
    36  	fake.pollMutex.Unlock()
    37  	if fake.PollStub != nil {
    38  		return fake.PollStub(arg1, arg2)
    39  	}
    40  	if specificReturn {
    41  		return ret.result1
    42  	}
    43  	fakeReturns := fake.pollReturns
    44  	return fakeReturns.result1
    45  }
    46  
    47  func (fake *FakePollerI) PollCallCount() int {
    48  	fake.pollMutex.RLock()
    49  	defer fake.pollMutex.RUnlock()
    50  	return len(fake.pollArgsForCall)
    51  }
    52  
    53  func (fake *FakePollerI) PollCalls(stub func(time.Duration, func() (bool, error)) error) {
    54  	fake.pollMutex.Lock()
    55  	defer fake.pollMutex.Unlock()
    56  	fake.PollStub = stub
    57  }
    58  
    59  func (fake *FakePollerI) PollArgsForCall(i int) (time.Duration, func() (bool, error)) {
    60  	fake.pollMutex.RLock()
    61  	defer fake.pollMutex.RUnlock()
    62  	argsForCall := fake.pollArgsForCall[i]
    63  	return argsForCall.arg1, argsForCall.arg2
    64  }
    65  
    66  func (fake *FakePollerI) PollReturns(result1 error) {
    67  	fake.pollMutex.Lock()
    68  	defer fake.pollMutex.Unlock()
    69  	fake.PollStub = nil
    70  	fake.pollReturns = struct {
    71  		result1 error
    72  	}{result1}
    73  }
    74  
    75  func (fake *FakePollerI) PollReturnsOnCall(i int, result1 error) {
    76  	fake.pollMutex.Lock()
    77  	defer fake.pollMutex.Unlock()
    78  	fake.PollStub = nil
    79  	if fake.pollReturnsOnCall == nil {
    80  		fake.pollReturnsOnCall = make(map[int]struct {
    81  			result1 error
    82  		})
    83  	}
    84  	fake.pollReturnsOnCall[i] = struct {
    85  		result1 error
    86  	}{result1}
    87  }
    88  
    89  func (fake *FakePollerI) Invocations() map[string][][]interface{} {
    90  	fake.invocationsMutex.RLock()
    91  	defer fake.invocationsMutex.RUnlock()
    92  	fake.pollMutex.RLock()
    93  	defer fake.pollMutex.RUnlock()
    94  	copiedInvocations := map[string][][]interface{}{}
    95  	for key, value := range fake.invocations {
    96  		copiedInvocations[key] = value
    97  	}
    98  	return copiedInvocations
    99  }
   100  
   101  func (fake *FakePollerI) recordInvocation(key string, args []interface{}) {
   102  	fake.invocationsMutex.Lock()
   103  	defer fake.invocationsMutex.Unlock()
   104  	if fake.invocations == nil {
   105  		fake.invocations = map[string][][]interface{}{}
   106  	}
   107  	if fake.invocations[key] == nil {
   108  		fake.invocations[key] = [][]interface{}{}
   109  	}
   110  	fake.invocations[key] = append(fake.invocations[key], args)
   111  }
   112  
   113  var _ poller.PollerI = new(FakePollerI)