github.com/cloudfoundry-attic/garden-linux@v0.333.2-candidate/linux_container/fake_watcher/fake_watcher.go (about)

     1  // This file was generated by counterfeiter
     2  package fake_watcher
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/cloudfoundry-incubator/garden-linux/linux_container"
     8  )
     9  
    10  type FakeWatcher struct {
    11  	WatchStub        func(func()) error
    12  	watchMutex       sync.RWMutex
    13  	watchArgsForCall []struct {
    14  		arg1 func()
    15  	}
    16  	watchReturns struct {
    17  		result1 error
    18  	}
    19  	UnwatchStub        func()
    20  	unwatchMutex       sync.RWMutex
    21  	unwatchArgsForCall []struct{}
    22  }
    23  
    24  func (fake *FakeWatcher) Watch(arg1 func()) error {
    25  	fake.watchMutex.Lock()
    26  	fake.watchArgsForCall = append(fake.watchArgsForCall, struct {
    27  		arg1 func()
    28  	}{arg1})
    29  	fake.watchMutex.Unlock()
    30  	if fake.WatchStub != nil {
    31  		return fake.WatchStub(arg1)
    32  	} else {
    33  		return fake.watchReturns.result1
    34  	}
    35  }
    36  
    37  func (fake *FakeWatcher) WatchCallCount() int {
    38  	fake.watchMutex.RLock()
    39  	defer fake.watchMutex.RUnlock()
    40  	return len(fake.watchArgsForCall)
    41  }
    42  
    43  func (fake *FakeWatcher) WatchArgsForCall(i int) func() {
    44  	fake.watchMutex.RLock()
    45  	defer fake.watchMutex.RUnlock()
    46  	return fake.watchArgsForCall[i].arg1
    47  }
    48  
    49  func (fake *FakeWatcher) WatchReturns(result1 error) {
    50  	fake.WatchStub = nil
    51  	fake.watchReturns = struct {
    52  		result1 error
    53  	}{result1}
    54  }
    55  
    56  func (fake *FakeWatcher) Unwatch() {
    57  	fake.unwatchMutex.Lock()
    58  	fake.unwatchArgsForCall = append(fake.unwatchArgsForCall, struct{}{})
    59  	fake.unwatchMutex.Unlock()
    60  	if fake.UnwatchStub != nil {
    61  		fake.UnwatchStub()
    62  	}
    63  }
    64  
    65  func (fake *FakeWatcher) UnwatchCallCount() int {
    66  	fake.unwatchMutex.RLock()
    67  	defer fake.unwatchMutex.RUnlock()
    68  	return len(fake.unwatchArgsForCall)
    69  }
    70  
    71  var _ linux_container.Watcher = new(FakeWatcher)