// Code generated by counterfeiter. DO NOT EDIT.
package runcontainerdfakes

import (
	"sync"

	"code.cloudfoundry.org/garden"
	"code.cloudfoundry.org/guardian/rundmc/goci"
	"code.cloudfoundry.org/guardian/rundmc/runcontainerd"
	"code.cloudfoundry.org/guardian/rundmc/users"
	specs "github.com/opencontainers/runtime-spec/specs-go"
)

type FakeProcessBuilder struct {
	BuildProcessStub        func(goci.Bndl, garden.ProcessSpec, *users.ExecUser) *specs.Process
	buildProcessMutex       sync.RWMutex
	buildProcessArgsForCall []struct {
		arg1 goci.Bndl
		arg2 garden.ProcessSpec
		arg3 *users.ExecUser
	}
	buildProcessReturns struct {
		result1 *specs.Process
	}
	buildProcessReturnsOnCall map[int]struct {
		result1 *specs.Process
	}
	invocations      map[string][][]interface{}
	invocationsMutex sync.RWMutex
}

func (fake *FakeProcessBuilder) BuildProcess(arg1 goci.Bndl, arg2 garden.ProcessSpec, arg3 *users.ExecUser) *specs.Process {
	fake.buildProcessMutex.Lock()
	ret, specificReturn := fake.buildProcessReturnsOnCall[len(fake.buildProcessArgsForCall)]
	fake.buildProcessArgsForCall = append(fake.buildProcessArgsForCall, struct {
		arg1 goci.Bndl
		arg2 garden.ProcessSpec
		arg3 *users.ExecUser
	}{arg1, arg2, arg3})
	stub := fake.BuildProcessStub
	fakeReturns := fake.buildProcessReturns
	fake.recordInvocation("BuildProcess", []interface{}{arg1, arg2, arg3})
	fake.buildProcessMutex.Unlock()
	if stub != nil {
		return stub(arg1, arg2, arg3)
	}
	if specificReturn {
		return ret.result1
	}
	return fakeReturns.result1
}

func (fake *FakeProcessBuilder) BuildProcessCallCount() int {
	fake.buildProcessMutex.RLock()
	defer fake.buildProcessMutex.RUnlock()
	return len(fake.buildProcessArgsForCall)
}

func (fake *FakeProcessBuilder) BuildProcessCalls(stub func(goci.Bndl, garden.ProcessSpec, *users.ExecUser) *specs.Process) {
	fake.buildProcessMutex.Lock()
	defer fake.buildProcessMutex.Unlock()
	fake.BuildProcessStub = stub
}

func (fake *FakeProcessBuilder) BuildProcessArgsForCall(i int) (goci.Bndl, garden.ProcessSpec, *users.ExecUser) {
	fake.buildProcessMutex.RLock()
	defer fake.buildProcessMutex.RUnlock()
	argsForCall := fake.buildProcessArgsForCall[i]
	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}

func (fake *FakeProcessBuilder) BuildProcessReturns(result1 *specs.Process) {
	fake.buildProcessMutex.Lock()
	defer fake.buildProcessMutex.Unlock()
	fake.BuildProcessStub = nil
	fake.buildProcessReturns = struct {
		result1 *specs.Process
	}{result1}
}

func (fake *FakeProcessBuilder) BuildProcessReturnsOnCall(i int, result1 *specs.Process) {
	fake.buildProcessMutex.Lock()
	defer fake.buildProcessMutex.Unlock()
	fake.BuildProcessStub = nil
	if fake.buildProcessReturnsOnCall == nil {
		fake.buildProcessReturnsOnCall = make(map[int]struct {
			result1 *specs.Process
		})
	}
	fake.buildProcessReturnsOnCall[i] = struct {
		result1 *specs.Process
	}{result1}
}

func (fake *FakeProcessBuilder) Invocations() map[string][][]interface{} {
	fake.invocationsMutex.RLock()
	defer fake.invocationsMutex.RUnlock()
	fake.buildProcessMutex.RLock()
	defer fake.buildProcessMutex.RUnlock()
	copiedInvocations := map[string][][]interface{}{}
	for key, value := range fake.invocations {
		copiedInvocations[key] = value
	}
	return copiedInvocations
}

func (fake *FakeProcessBuilder) recordInvocation(key string, args []interface{}) {
	fake.invocationsMutex.Lock()
	defer fake.invocationsMutex.Unlock()
	if fake.invocations == nil {
		fake.invocations = map[string][][]interface{}{}
	}
	if fake.invocations[key] == nil {
		fake.invocations[key] = [][]interface{}{}
	}
	fake.invocations[key] = append(fake.invocations[key], args)
}

var _ runcontainerd.ProcessBuilder = new(FakeProcessBuilder)
