github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/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  	"code.cloudfoundry.org/cli/api/cloudcontroller"
     8  )
     9  
    10  type FakeConnection struct {
    11  	MakeStub        func(*cloudcontroller.Request, *cloudcontroller.Response) error
    12  	makeMutex       sync.RWMutex
    13  	makeArgsForCall []struct {
    14  		arg1 *cloudcontroller.Request
    15  		arg2 *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(arg1 *cloudcontroller.Request, arg2 *cloudcontroller.Response) error {
    28  	fake.makeMutex.Lock()
    29  	ret, specificReturn := fake.makeReturnsOnCall[len(fake.makeArgsForCall)]
    30  	fake.makeArgsForCall = append(fake.makeArgsForCall, struct {
    31  		arg1 *cloudcontroller.Request
    32  		arg2 *cloudcontroller.Response
    33  	}{arg1, arg2})
    34  	fake.recordInvocation("Make", []interface{}{arg1, arg2})
    35  	fake.makeMutex.Unlock()
    36  	if fake.MakeStub != nil {
    37  		return fake.MakeStub(arg1, arg2)
    38  	}
    39  	if specificReturn {
    40  		return ret.result1
    41  	}
    42  	fakeReturns := fake.makeReturns
    43  	return fakeReturns.result1
    44  }
    45  
    46  func (fake *FakeConnection) MakeCallCount() int {
    47  	fake.makeMutex.RLock()
    48  	defer fake.makeMutex.RUnlock()
    49  	return len(fake.makeArgsForCall)
    50  }
    51  
    52  func (fake *FakeConnection) MakeCalls(stub func(*cloudcontroller.Request, *cloudcontroller.Response) error) {
    53  	fake.makeMutex.Lock()
    54  	defer fake.makeMutex.Unlock()
    55  	fake.MakeStub = stub
    56  }
    57  
    58  func (fake *FakeConnection) MakeArgsForCall(i int) (*cloudcontroller.Request, *cloudcontroller.Response) {
    59  	fake.makeMutex.RLock()
    60  	defer fake.makeMutex.RUnlock()
    61  	argsForCall := fake.makeArgsForCall[i]
    62  	return argsForCall.arg1, argsForCall.arg2
    63  }
    64  
    65  func (fake *FakeConnection) MakeReturns(result1 error) {
    66  	fake.makeMutex.Lock()
    67  	defer fake.makeMutex.Unlock()
    68  	fake.MakeStub = nil
    69  	fake.makeReturns = struct {
    70  		result1 error
    71  	}{result1}
    72  }
    73  
    74  func (fake *FakeConnection) MakeReturnsOnCall(i int, result1 error) {
    75  	fake.makeMutex.Lock()
    76  	defer fake.makeMutex.Unlock()
    77  	fake.MakeStub = nil
    78  	if fake.makeReturnsOnCall == nil {
    79  		fake.makeReturnsOnCall = make(map[int]struct {
    80  			result1 error
    81  		})
    82  	}
    83  	fake.makeReturnsOnCall[i] = struct {
    84  		result1 error
    85  	}{result1}
    86  }
    87  
    88  func (fake *FakeConnection) Invocations() map[string][][]interface{} {
    89  	fake.invocationsMutex.RLock()
    90  	defer fake.invocationsMutex.RUnlock()
    91  	fake.makeMutex.RLock()
    92  	defer fake.makeMutex.RUnlock()
    93  	copiedInvocations := map[string][][]interface{}{}
    94  	for key, value := range fake.invocations {
    95  		copiedInvocations[key] = value
    96  	}
    97  	return copiedInvocations
    98  }
    99  
   100  func (fake *FakeConnection) recordInvocation(key string, args []interface{}) {
   101  	fake.invocationsMutex.Lock()
   102  	defer fake.invocationsMutex.Unlock()
   103  	if fake.invocations == nil {
   104  		fake.invocations = map[string][][]interface{}{}
   105  	}
   106  	if fake.invocations[key] == nil {
   107  		fake.invocations[key] = [][]interface{}{}
   108  	}
   109  	fake.invocations[key] = append(fake.invocations[key], args)
   110  }
   111  
   112  var _ cloudcontroller.Connection = new(FakeConnection)