github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/commandregistry/commandregistryfakes/fake_random_word_generator.go (about)

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