github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/requirements/requirementsfakes/fake_requirement.go (about)

     1  // This file was generated by counterfeiter
     2  package requirementsfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/requirements"
     8  )
     9  
    10  type FakeRequirement struct {
    11  	ExecuteStub        func() error
    12  	executeMutex       sync.RWMutex
    13  	executeArgsForCall []struct{}
    14  	executeReturns     struct {
    15  		result1 error
    16  	}
    17  	invocations      map[string][][]interface{}
    18  	invocationsMutex sync.RWMutex
    19  }
    20  
    21  func (fake *FakeRequirement) Execute() error {
    22  	fake.executeMutex.Lock()
    23  	fake.executeArgsForCall = append(fake.executeArgsForCall, struct{}{})
    24  	fake.recordInvocation("Execute", []interface{}{})
    25  	fake.executeMutex.Unlock()
    26  	if fake.ExecuteStub != nil {
    27  		return fake.ExecuteStub()
    28  	} else {
    29  		return fake.executeReturns.result1
    30  	}
    31  }
    32  
    33  func (fake *FakeRequirement) ExecuteCallCount() int {
    34  	fake.executeMutex.RLock()
    35  	defer fake.executeMutex.RUnlock()
    36  	return len(fake.executeArgsForCall)
    37  }
    38  
    39  func (fake *FakeRequirement) ExecuteReturns(result1 error) {
    40  	fake.ExecuteStub = nil
    41  	fake.executeReturns = struct {
    42  		result1 error
    43  	}{result1}
    44  }
    45  
    46  func (fake *FakeRequirement) Invocations() map[string][][]interface{} {
    47  	fake.invocationsMutex.RLock()
    48  	defer fake.invocationsMutex.RUnlock()
    49  	fake.executeMutex.RLock()
    50  	defer fake.executeMutex.RUnlock()
    51  	return fake.invocations
    52  }
    53  
    54  func (fake *FakeRequirement) recordInvocation(key string, args []interface{}) {
    55  	fake.invocationsMutex.Lock()
    56  	defer fake.invocationsMutex.Unlock()
    57  	if fake.invocations == nil {
    58  		fake.invocations = map[string][][]interface{}{}
    59  	}
    60  	if fake.invocations[key] == nil {
    61  		fake.invocations[key] = [][]interface{}{}
    62  	}
    63  	fake.invocations[key] = append(fake.invocations[key], args)
    64  }
    65  
    66  var _ requirements.Requirement = new(FakeRequirement)