github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+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  	babbleReturns     struct {
    15  		result1 string
    16  	}
    17  	babbleReturnsOnCall map[int]struct {
    18  		result1 string
    19  	}
    20  	invocations      map[string][][]interface{}
    21  	invocationsMutex sync.RWMutex
    22  }
    23  
    24  func (fake *FakeRandomWordGenerator) Babble() string {
    25  	fake.babbleMutex.Lock()
    26  	ret, specificReturn := fake.babbleReturnsOnCall[len(fake.babbleArgsForCall)]
    27  	fake.babbleArgsForCall = append(fake.babbleArgsForCall, struct{}{})
    28  	fake.recordInvocation("Babble", []interface{}{})
    29  	fake.babbleMutex.Unlock()
    30  	if fake.BabbleStub != nil {
    31  		return fake.BabbleStub()
    32  	}
    33  	if specificReturn {
    34  		return ret.result1
    35  	}
    36  	return fake.babbleReturns.result1
    37  }
    38  
    39  func (fake *FakeRandomWordGenerator) BabbleCallCount() int {
    40  	fake.babbleMutex.RLock()
    41  	defer fake.babbleMutex.RUnlock()
    42  	return len(fake.babbleArgsForCall)
    43  }
    44  
    45  func (fake *FakeRandomWordGenerator) BabbleReturns(result1 string) {
    46  	fake.BabbleStub = nil
    47  	fake.babbleReturns = struct {
    48  		result1 string
    49  	}{result1}
    50  }
    51  
    52  func (fake *FakeRandomWordGenerator) BabbleReturnsOnCall(i int, result1 string) {
    53  	fake.BabbleStub = nil
    54  	if fake.babbleReturnsOnCall == nil {
    55  		fake.babbleReturnsOnCall = make(map[int]struct {
    56  			result1 string
    57  		})
    58  	}
    59  	fake.babbleReturnsOnCall[i] = struct {
    60  		result1 string
    61  	}{result1}
    62  }
    63  
    64  func (fake *FakeRandomWordGenerator) Invocations() map[string][][]interface{} {
    65  	fake.invocationsMutex.RLock()
    66  	defer fake.invocationsMutex.RUnlock()
    67  	fake.babbleMutex.RLock()
    68  	defer fake.babbleMutex.RUnlock()
    69  	copiedInvocations := map[string][][]interface{}{}
    70  	for key, value := range fake.invocations {
    71  		copiedInvocations[key] = value
    72  	}
    73  	return copiedInvocations
    74  }
    75  
    76  func (fake *FakeRandomWordGenerator) recordInvocation(key string, args []interface{}) {
    77  	fake.invocationsMutex.Lock()
    78  	defer fake.invocationsMutex.Unlock()
    79  	if fake.invocations == nil {
    80  		fake.invocations = map[string][][]interface{}{}
    81  	}
    82  	if fake.invocations[key] == nil {
    83  		fake.invocations[key] = [][]interface{}{}
    84  	}
    85  	fake.invocations[key] = append(fake.invocations[key], args)
    86  }
    87  
    88  var _ commandregistry.RandomWordGenerator = new(FakeRandomWordGenerator)