github.com/liamawhite/cli-with-i18n@v6.32.1-0.20171122084555-dede0a5c3448+incompatible/api/cloudcontroller/cloudcontrollerfakes/fake_connection.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package cloudcontrollerfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/liamawhite/cli-with-i18n/api/cloudcontroller"
     8  )
     9  
    10  type FakeConnection struct {
    11  	MakeStub        func(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error
    12  	makeMutex       sync.RWMutex
    13  	makeArgsForCall []struct {
    14  		request        *cloudcontroller.Request
    15  		passedResponse *cloudcontroller.Response
    16  	}
    17  	makeReturns struct {
    18  		result1 error
    19  	}
    20  	makeReturnsOnCall map[int]struct {
    21  		result1 error
    22  	}
    23  	invocations      map[string][][]interface{}
    24  	invocationsMutex sync.RWMutex
    25  }
    26  
    27  func (fake *FakeConnection) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error {
    28  	fake.makeMutex.Lock()
    29  	ret, specificReturn := fake.makeReturnsOnCall[len(fake.makeArgsForCall)]
    30  	fake.makeArgsForCall = append(fake.makeArgsForCall, struct {
    31  		request        *cloudcontroller.Request
    32  		passedResponse *cloudcontroller.Response
    33  	}{request, passedResponse})
    34  	fake.recordInvocation("Make", []interface{}{request, passedResponse})
    35  	fake.makeMutex.Unlock()
    36  	if fake.MakeStub != nil {
    37  		return fake.MakeStub(request, passedResponse)
    38  	}
    39  	if specificReturn {
    40  		return ret.result1
    41  	}
    42  	return fake.makeReturns.result1
    43  }
    44  
    45  func (fake *FakeConnection) MakeCallCount() int {
    46  	fake.makeMutex.RLock()
    47  	defer fake.makeMutex.RUnlock()
    48  	return len(fake.makeArgsForCall)
    49  }
    50  
    51  func (fake *FakeConnection) MakeArgsForCall(i int) (*cloudcontroller.Request, *cloudcontroller.Response) {
    52  	fake.makeMutex.RLock()
    53  	defer fake.makeMutex.RUnlock()
    54  	return fake.makeArgsForCall[i].request, fake.makeArgsForCall[i].passedResponse
    55  }
    56  
    57  func (fake *FakeConnection) MakeReturns(result1 error) {
    58  	fake.MakeStub = nil
    59  	fake.makeReturns = struct {
    60  		result1 error
    61  	}{result1}
    62  }
    63  
    64  func (fake *FakeConnection) MakeReturnsOnCall(i int, result1 error) {
    65  	fake.MakeStub = nil
    66  	if fake.makeReturnsOnCall == nil {
    67  		fake.makeReturnsOnCall = make(map[int]struct {
    68  			result1 error
    69  		})
    70  	}
    71  	fake.makeReturnsOnCall[i] = struct {
    72  		result1 error
    73  	}{result1}
    74  }
    75  
    76  func (fake *FakeConnection) Invocations() map[string][][]interface{} {
    77  	fake.invocationsMutex.RLock()
    78  	defer fake.invocationsMutex.RUnlock()
    79  	fake.makeMutex.RLock()
    80  	defer fake.makeMutex.RUnlock()
    81  	copiedInvocations := map[string][][]interface{}{}
    82  	for key, value := range fake.invocations {
    83  		copiedInvocations[key] = value
    84  	}
    85  	return copiedInvocations
    86  }
    87  
    88  func (fake *FakeConnection) recordInvocation(key string, args []interface{}) {
    89  	fake.invocationsMutex.Lock()
    90  	defer fake.invocationsMutex.Unlock()
    91  	if fake.invocations == nil {
    92  		fake.invocations = map[string][][]interface{}{}
    93  	}
    94  	if fake.invocations[key] == nil {
    95  		fake.invocations[key] = [][]interface{}{}
    96  	}
    97  	fake.invocations[key] = append(fake.invocations[key], args)
    98  }
    99  
   100  var _ cloudcontroller.Connection = new(FakeConnection)