github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/actor/v7action/v7actionfakes/fake_downloader.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package v7actionfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/actor/v7action"
     8  )
     9  
    10  type FakeDownloader struct {
    11  	DownloadStub        func(string, string) (string, error)
    12  	downloadMutex       sync.RWMutex
    13  	downloadArgsForCall []struct {
    14  		arg1 string
    15  		arg2 string
    16  	}
    17  	downloadReturns struct {
    18  		result1 string
    19  		result2 error
    20  	}
    21  	downloadReturnsOnCall map[int]struct {
    22  		result1 string
    23  		result2 error
    24  	}
    25  	invocations      map[string][][]interface{}
    26  	invocationsMutex sync.RWMutex
    27  }
    28  
    29  func (fake *FakeDownloader) Download(arg1 string, arg2 string) (string, error) {
    30  	fake.downloadMutex.Lock()
    31  	ret, specificReturn := fake.downloadReturnsOnCall[len(fake.downloadArgsForCall)]
    32  	fake.downloadArgsForCall = append(fake.downloadArgsForCall, struct {
    33  		arg1 string
    34  		arg2 string
    35  	}{arg1, arg2})
    36  	fake.recordInvocation("Download", []interface{}{arg1, arg2})
    37  	fake.downloadMutex.Unlock()
    38  	if fake.DownloadStub != nil {
    39  		return fake.DownloadStub(arg1, arg2)
    40  	}
    41  	if specificReturn {
    42  		return ret.result1, ret.result2
    43  	}
    44  	fakeReturns := fake.downloadReturns
    45  	return fakeReturns.result1, fakeReturns.result2
    46  }
    47  
    48  func (fake *FakeDownloader) DownloadCallCount() int {
    49  	fake.downloadMutex.RLock()
    50  	defer fake.downloadMutex.RUnlock()
    51  	return len(fake.downloadArgsForCall)
    52  }
    53  
    54  func (fake *FakeDownloader) DownloadCalls(stub func(string, string) (string, error)) {
    55  	fake.downloadMutex.Lock()
    56  	defer fake.downloadMutex.Unlock()
    57  	fake.DownloadStub = stub
    58  }
    59  
    60  func (fake *FakeDownloader) DownloadArgsForCall(i int) (string, string) {
    61  	fake.downloadMutex.RLock()
    62  	defer fake.downloadMutex.RUnlock()
    63  	argsForCall := fake.downloadArgsForCall[i]
    64  	return argsForCall.arg1, argsForCall.arg2
    65  }
    66  
    67  func (fake *FakeDownloader) DownloadReturns(result1 string, result2 error) {
    68  	fake.downloadMutex.Lock()
    69  	defer fake.downloadMutex.Unlock()
    70  	fake.DownloadStub = nil
    71  	fake.downloadReturns = struct {
    72  		result1 string
    73  		result2 error
    74  	}{result1, result2}
    75  }
    76  
    77  func (fake *FakeDownloader) DownloadReturnsOnCall(i int, result1 string, result2 error) {
    78  	fake.downloadMutex.Lock()
    79  	defer fake.downloadMutex.Unlock()
    80  	fake.DownloadStub = nil
    81  	if fake.downloadReturnsOnCall == nil {
    82  		fake.downloadReturnsOnCall = make(map[int]struct {
    83  			result1 string
    84  			result2 error
    85  		})
    86  	}
    87  	fake.downloadReturnsOnCall[i] = struct {
    88  		result1 string
    89  		result2 error
    90  	}{result1, result2}
    91  }
    92  
    93  func (fake *FakeDownloader) Invocations() map[string][][]interface{} {
    94  	fake.invocationsMutex.RLock()
    95  	defer fake.invocationsMutex.RUnlock()
    96  	fake.downloadMutex.RLock()
    97  	defer fake.downloadMutex.RUnlock()
    98  	copiedInvocations := map[string][][]interface{}{}
    99  	for key, value := range fake.invocations {
   100  		copiedInvocations[key] = value
   101  	}
   102  	return copiedInvocations
   103  }
   104  
   105  func (fake *FakeDownloader) recordInvocation(key string, args []interface{}) {
   106  	fake.invocationsMutex.Lock()
   107  	defer fake.invocationsMutex.Unlock()
   108  	if fake.invocations == nil {
   109  		fake.invocations = map[string][][]interface{}{}
   110  	}
   111  	if fake.invocations[key] == nil {
   112  		fake.invocations[key] = [][]interface{}{}
   113  	}
   114  	fake.invocations[key] = append(fake.invocations[key], args)
   115  }
   116  
   117  var _ v7action.Downloader = new(FakeDownloader)