github.com/cloudfoundry-attic/ltc@v0.0.0-20151123212628-098adc7919fc/ssh/mocks/fake_listener.go (about)

     1  // This file was generated by counterfeiter
     2  package mocks
     3  
     4  import (
     5  	"io"
     6  	"sync"
     7  
     8  	"github.com/cloudfoundry-incubator/ltc/ssh"
     9  )
    10  
    11  type FakeListener struct {
    12  	ListenStub        func(network, laddr string) (<-chan io.ReadWriteCloser, <-chan error)
    13  	listenMutex       sync.RWMutex
    14  	listenArgsForCall []struct {
    15  		network string
    16  		laddr   string
    17  	}
    18  	listenReturns struct {
    19  		result1 <-chan io.ReadWriteCloser
    20  		result2 <-chan error
    21  	}
    22  }
    23  
    24  func (fake *FakeListener) Listen(network string, laddr string) (<-chan io.ReadWriteCloser, <-chan error) {
    25  	fake.listenMutex.Lock()
    26  	fake.listenArgsForCall = append(fake.listenArgsForCall, struct {
    27  		network string
    28  		laddr   string
    29  	}{network, laddr})
    30  	fake.listenMutex.Unlock()
    31  	if fake.ListenStub != nil {
    32  		return fake.ListenStub(network, laddr)
    33  	} else {
    34  		return fake.listenReturns.result1, fake.listenReturns.result2
    35  	}
    36  }
    37  
    38  func (fake *FakeListener) ListenCallCount() int {
    39  	fake.listenMutex.RLock()
    40  	defer fake.listenMutex.RUnlock()
    41  	return len(fake.listenArgsForCall)
    42  }
    43  
    44  func (fake *FakeListener) ListenArgsForCall(i int) (string, string) {
    45  	fake.listenMutex.RLock()
    46  	defer fake.listenMutex.RUnlock()
    47  	return fake.listenArgsForCall[i].network, fake.listenArgsForCall[i].laddr
    48  }
    49  
    50  func (fake *FakeListener) ListenReturns(result1 <-chan io.ReadWriteCloser, result2 <-chan error) {
    51  	fake.ListenStub = nil
    52  	fake.listenReturns = struct {
    53  		result1 <-chan io.ReadWriteCloser
    54  		result2 <-chan error
    55  	}{result1, result2}
    56  }
    57  
    58  var _ ssh.Listener = new(FakeListener)