github.com/orange-cloudfoundry/cli@v7.1.0+incompatible/api/cloudcontroller/ccv3/ccv3fakes/fake_clock.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package ccv3fakes
     3  
     4  import (
     5  	"sync"
     6  	"time"
     7  
     8  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"
     9  )
    10  
    11  type FakeClock struct {
    12  	NowStub        func() time.Time
    13  	nowMutex       sync.RWMutex
    14  	nowArgsForCall []struct {
    15  	}
    16  	nowReturns struct {
    17  		result1 time.Time
    18  	}
    19  	nowReturnsOnCall map[int]struct {
    20  		result1 time.Time
    21  	}
    22  	invocations      map[string][][]interface{}
    23  	invocationsMutex sync.RWMutex
    24  }
    25  
    26  func (fake *FakeClock) Now() time.Time {
    27  	fake.nowMutex.Lock()
    28  	ret, specificReturn := fake.nowReturnsOnCall[len(fake.nowArgsForCall)]
    29  	fake.nowArgsForCall = append(fake.nowArgsForCall, struct {
    30  	}{})
    31  	fake.recordInvocation("Now", []interface{}{})
    32  	fake.nowMutex.Unlock()
    33  	if fake.NowStub != nil {
    34  		return fake.NowStub()
    35  	}
    36  	if specificReturn {
    37  		return ret.result1
    38  	}
    39  	fakeReturns := fake.nowReturns
    40  	return fakeReturns.result1
    41  }
    42  
    43  func (fake *FakeClock) NowCallCount() int {
    44  	fake.nowMutex.RLock()
    45  	defer fake.nowMutex.RUnlock()
    46  	return len(fake.nowArgsForCall)
    47  }
    48  
    49  func (fake *FakeClock) NowCalls(stub func() time.Time) {
    50  	fake.nowMutex.Lock()
    51  	defer fake.nowMutex.Unlock()
    52  	fake.NowStub = stub
    53  }
    54  
    55  func (fake *FakeClock) NowReturns(result1 time.Time) {
    56  	fake.nowMutex.Lock()
    57  	defer fake.nowMutex.Unlock()
    58  	fake.NowStub = nil
    59  	fake.nowReturns = struct {
    60  		result1 time.Time
    61  	}{result1}
    62  }
    63  
    64  func (fake *FakeClock) NowReturnsOnCall(i int, result1 time.Time) {
    65  	fake.nowMutex.Lock()
    66  	defer fake.nowMutex.Unlock()
    67  	fake.NowStub = nil
    68  	if fake.nowReturnsOnCall == nil {
    69  		fake.nowReturnsOnCall = make(map[int]struct {
    70  			result1 time.Time
    71  		})
    72  	}
    73  	fake.nowReturnsOnCall[i] = struct {
    74  		result1 time.Time
    75  	}{result1}
    76  }
    77  
    78  func (fake *FakeClock) Invocations() map[string][][]interface{} {
    79  	fake.invocationsMutex.RLock()
    80  	defer fake.invocationsMutex.RUnlock()
    81  	fake.nowMutex.RLock()
    82  	defer fake.nowMutex.RUnlock()
    83  	copiedInvocations := map[string][][]interface{}{}
    84  	for key, value := range fake.invocations {
    85  		copiedInvocations[key] = value
    86  	}
    87  	return copiedInvocations
    88  }
    89  
    90  func (fake *FakeClock) recordInvocation(key string, args []interface{}) {
    91  	fake.invocationsMutex.Lock()
    92  	defer fake.invocationsMutex.Unlock()
    93  	if fake.invocations == nil {
    94  		fake.invocations = map[string][][]interface{}{}
    95  	}
    96  	if fake.invocations[key] == nil {
    97  		fake.invocations[key] = [][]interface{}{}
    98  	}
    99  	fake.invocations[key] = append(fake.invocations[key], args)
   100  }
   101  
   102  var _ ccv3.Clock = new(FakeClock)