github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/api/uaa/uaafakes/fake_connection.go (about)

     1  // This file was generated by counterfeiter
     2  package uaafakes
     3  
     4  import (
     5  	"net/http"
     6  	"sync"
     7  
     8  	"code.cloudfoundry.org/cli/api/uaa"
     9  )
    10  
    11  type FakeConnection struct {
    12  	MakeStub        func(request *http.Request, passedResponse *uaa.Response) error
    13  	makeMutex       sync.RWMutex
    14  	makeArgsForCall []struct {
    15  		request        *http.Request
    16  		passedResponse *uaa.Response
    17  	}
    18  	makeReturns struct {
    19  		result1 error
    20  	}
    21  	invocations      map[string][][]interface{}
    22  	invocationsMutex sync.RWMutex
    23  }
    24  
    25  func (fake *FakeConnection) Make(request *http.Request, passedResponse *uaa.Response) error {
    26  	fake.makeMutex.Lock()
    27  	fake.makeArgsForCall = append(fake.makeArgsForCall, struct {
    28  		request        *http.Request
    29  		passedResponse *uaa.Response
    30  	}{request, passedResponse})
    31  	fake.recordInvocation("Make", []interface{}{request, passedResponse})
    32  	fake.makeMutex.Unlock()
    33  	if fake.MakeStub != nil {
    34  		return fake.MakeStub(request, passedResponse)
    35  	} else {
    36  		return fake.makeReturns.result1
    37  	}
    38  }
    39  
    40  func (fake *FakeConnection) MakeCallCount() int {
    41  	fake.makeMutex.RLock()
    42  	defer fake.makeMutex.RUnlock()
    43  	return len(fake.makeArgsForCall)
    44  }
    45  
    46  func (fake *FakeConnection) MakeArgsForCall(i int) (*http.Request, *uaa.Response) {
    47  	fake.makeMutex.RLock()
    48  	defer fake.makeMutex.RUnlock()
    49  	return fake.makeArgsForCall[i].request, fake.makeArgsForCall[i].passedResponse
    50  }
    51  
    52  func (fake *FakeConnection) MakeReturns(result1 error) {
    53  	fake.MakeStub = nil
    54  	fake.makeReturns = struct {
    55  		result1 error
    56  	}{result1}
    57  }
    58  
    59  func (fake *FakeConnection) Invocations() map[string][][]interface{} {
    60  	fake.invocationsMutex.RLock()
    61  	defer fake.invocationsMutex.RUnlock()
    62  	fake.makeMutex.RLock()
    63  	defer fake.makeMutex.RUnlock()
    64  	return fake.invocations
    65  }
    66  
    67  func (fake *FakeConnection) recordInvocation(key string, args []interface{}) {
    68  	fake.invocationsMutex.Lock()
    69  	defer fake.invocationsMutex.Unlock()
    70  	if fake.invocations == nil {
    71  		fake.invocations = map[string][][]interface{}{}
    72  	}
    73  	if fake.invocations[key] == nil {
    74  		fake.invocations[key] = [][]interface{}{}
    75  	}
    76  	fake.invocations[key] = append(fake.invocations[key], args)
    77  }
    78  
    79  var _ uaa.Connection = new(FakeConnection)