github.com/jenspinney/cli@v6.42.1-0.20190207184520-7450c600020e+incompatible/cf/errors/errorsfakes/fake_httperror.go (about)

     1  // This file was generated by counterfeiter
     2  package errorsfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/errors"
     8  )
     9  
    10  type FakeHTTPError struct {
    11  	ErrorStub        func() string
    12  	errorMutex       sync.RWMutex
    13  	errorArgsForCall []struct{}
    14  	errorReturns     struct {
    15  		result1 string
    16  	}
    17  	StatusCodeStub        func() int
    18  	statusCodeMutex       sync.RWMutex
    19  	statusCodeArgsForCall []struct{}
    20  	statusCodeReturns     struct {
    21  		result1 int
    22  	}
    23  	ErrorCodeStub        func() string
    24  	errorCodeMutex       sync.RWMutex
    25  	errorCodeArgsForCall []struct{}
    26  	errorCodeReturns     struct {
    27  		result1 string
    28  	}
    29  	invocations      map[string][][]interface{}
    30  	invocationsMutex sync.RWMutex
    31  }
    32  
    33  func (fake *FakeHTTPError) Error() string {
    34  	fake.errorMutex.Lock()
    35  	fake.errorArgsForCall = append(fake.errorArgsForCall, struct{}{})
    36  	fake.recordInvocation("Error", []interface{}{})
    37  	fake.errorMutex.Unlock()
    38  	if fake.ErrorStub != nil {
    39  		return fake.ErrorStub()
    40  	} else {
    41  		return fake.errorReturns.result1
    42  	}
    43  }
    44  
    45  func (fake *FakeHTTPError) ErrorCallCount() int {
    46  	fake.errorMutex.RLock()
    47  	defer fake.errorMutex.RUnlock()
    48  	return len(fake.errorArgsForCall)
    49  }
    50  
    51  func (fake *FakeHTTPError) ErrorReturns(result1 string) {
    52  	fake.ErrorStub = nil
    53  	fake.errorReturns = struct {
    54  		result1 string
    55  	}{result1}
    56  }
    57  
    58  func (fake *FakeHTTPError) StatusCode() int {
    59  	fake.statusCodeMutex.Lock()
    60  	fake.statusCodeArgsForCall = append(fake.statusCodeArgsForCall, struct{}{})
    61  	fake.recordInvocation("StatusCode", []interface{}{})
    62  	fake.statusCodeMutex.Unlock()
    63  	if fake.StatusCodeStub != nil {
    64  		return fake.StatusCodeStub()
    65  	} else {
    66  		return fake.statusCodeReturns.result1
    67  	}
    68  }
    69  
    70  func (fake *FakeHTTPError) StatusCodeCallCount() int {
    71  	fake.statusCodeMutex.RLock()
    72  	defer fake.statusCodeMutex.RUnlock()
    73  	return len(fake.statusCodeArgsForCall)
    74  }
    75  
    76  func (fake *FakeHTTPError) StatusCodeReturns(result1 int) {
    77  	fake.StatusCodeStub = nil
    78  	fake.statusCodeReturns = struct {
    79  		result1 int
    80  	}{result1}
    81  }
    82  
    83  func (fake *FakeHTTPError) ErrorCode() string {
    84  	fake.errorCodeMutex.Lock()
    85  	fake.errorCodeArgsForCall = append(fake.errorCodeArgsForCall, struct{}{})
    86  	fake.recordInvocation("ErrorCode", []interface{}{})
    87  	fake.errorCodeMutex.Unlock()
    88  	if fake.ErrorCodeStub != nil {
    89  		return fake.ErrorCodeStub()
    90  	} else {
    91  		return fake.errorCodeReturns.result1
    92  	}
    93  }
    94  
    95  func (fake *FakeHTTPError) ErrorCodeCallCount() int {
    96  	fake.errorCodeMutex.RLock()
    97  	defer fake.errorCodeMutex.RUnlock()
    98  	return len(fake.errorCodeArgsForCall)
    99  }
   100  
   101  func (fake *FakeHTTPError) ErrorCodeReturns(result1 string) {
   102  	fake.ErrorCodeStub = nil
   103  	fake.errorCodeReturns = struct {
   104  		result1 string
   105  	}{result1}
   106  }
   107  
   108  func (fake *FakeHTTPError) Invocations() map[string][][]interface{} {
   109  	fake.invocationsMutex.RLock()
   110  	defer fake.invocationsMutex.RUnlock()
   111  	fake.errorMutex.RLock()
   112  	defer fake.errorMutex.RUnlock()
   113  	fake.statusCodeMutex.RLock()
   114  	defer fake.statusCodeMutex.RUnlock()
   115  	fake.errorCodeMutex.RLock()
   116  	defer fake.errorCodeMutex.RUnlock()
   117  	return fake.invocations
   118  }
   119  
   120  func (fake *FakeHTTPError) recordInvocation(key string, args []interface{}) {
   121  	fake.invocationsMutex.Lock()
   122  	defer fake.invocationsMutex.Unlock()
   123  	if fake.invocations == nil {
   124  		fake.invocations = map[string][][]interface{}{}
   125  	}
   126  	if fake.invocations[key] == nil {
   127  		fake.invocations[key] = [][]interface{}{}
   128  	}
   129  	fake.invocations[key] = append(fake.invocations[key], args)
   130  }
   131  
   132  var _ errors.HTTPError = new(FakeHTTPError)