github.com/cloudfoundry-attic/ltc@v0.0.0-20151123212628-098adc7919fc/version/fake_file_swapper/fake_file_swapper.go (about)

     1  // This file was generated by counterfeiter
     2  package fake_file_swapper
     3  
     4  import (
     5  	"os"
     6  	"sync"
     7  
     8  	"github.com/cloudfoundry-incubator/ltc/version"
     9  )
    10  
    11  type FakeFileSwapper struct {
    12  	GetTempFileStub        func() (*os.File, error)
    13  	getTempFileMutex       sync.RWMutex
    14  	getTempFileArgsForCall []struct{}
    15  	getTempFileReturns     struct {
    16  		result1 *os.File
    17  		result2 error
    18  	}
    19  	SwapTempFileStub        func(destPath, srcPath string) error
    20  	swapTempFileMutex       sync.RWMutex
    21  	swapTempFileArgsForCall []struct {
    22  		destPath string
    23  		srcPath  string
    24  	}
    25  	swapTempFileReturns struct {
    26  		result1 error
    27  	}
    28  }
    29  
    30  func (fake *FakeFileSwapper) GetTempFile() (*os.File, error) {
    31  	fake.getTempFileMutex.Lock()
    32  	fake.getTempFileArgsForCall = append(fake.getTempFileArgsForCall, struct{}{})
    33  	fake.getTempFileMutex.Unlock()
    34  	if fake.GetTempFileStub != nil {
    35  		return fake.GetTempFileStub()
    36  	} else {
    37  		return fake.getTempFileReturns.result1, fake.getTempFileReturns.result2
    38  	}
    39  }
    40  
    41  func (fake *FakeFileSwapper) GetTempFileCallCount() int {
    42  	fake.getTempFileMutex.RLock()
    43  	defer fake.getTempFileMutex.RUnlock()
    44  	return len(fake.getTempFileArgsForCall)
    45  }
    46  
    47  func (fake *FakeFileSwapper) GetTempFileReturns(result1 *os.File, result2 error) {
    48  	fake.GetTempFileStub = nil
    49  	fake.getTempFileReturns = struct {
    50  		result1 *os.File
    51  		result2 error
    52  	}{result1, result2}
    53  }
    54  
    55  func (fake *FakeFileSwapper) SwapTempFile(destPath string, srcPath string) error {
    56  	fake.swapTempFileMutex.Lock()
    57  	fake.swapTempFileArgsForCall = append(fake.swapTempFileArgsForCall, struct {
    58  		destPath string
    59  		srcPath  string
    60  	}{destPath, srcPath})
    61  	fake.swapTempFileMutex.Unlock()
    62  	if fake.SwapTempFileStub != nil {
    63  		return fake.SwapTempFileStub(destPath, srcPath)
    64  	} else {
    65  		return fake.swapTempFileReturns.result1
    66  	}
    67  }
    68  
    69  func (fake *FakeFileSwapper) SwapTempFileCallCount() int {
    70  	fake.swapTempFileMutex.RLock()
    71  	defer fake.swapTempFileMutex.RUnlock()
    72  	return len(fake.swapTempFileArgsForCall)
    73  }
    74  
    75  func (fake *FakeFileSwapper) SwapTempFileArgsForCall(i int) (string, string) {
    76  	fake.swapTempFileMutex.RLock()
    77  	defer fake.swapTempFileMutex.RUnlock()
    78  	return fake.swapTempFileArgsForCall[i].destPath, fake.swapTempFileArgsForCall[i].srcPath
    79  }
    80  
    81  func (fake *FakeFileSwapper) SwapTempFileReturns(result1 error) {
    82  	fake.SwapTempFileStub = nil
    83  	fake.swapTempFileReturns = struct {
    84  		result1 error
    85  	}{result1}
    86  }
    87  
    88  var _ version.FileSwapper = new(FakeFileSwapper)