/
fake_cpifactory.go
77 lines (67 loc) · 1.91 KB
/
fake_cpifactory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// This file was generated by counterfeiter
package apiv1fakes
import (
"sync"
"github.com/cppforlife/bosh-cpi-go/apiv1"
)
type FakeCPIFactory struct {
NewStub func(apiv1.CallContext) (apiv1.CPI, error)
newMutex sync.RWMutex
newArgsForCall []struct {
arg1 apiv1.CallContext
}
newReturns struct {
result1 apiv1.CPI
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeCPIFactory) New(arg1 apiv1.CallContext) (apiv1.CPI, error) {
fake.newMutex.Lock()
fake.newArgsForCall = append(fake.newArgsForCall, struct {
arg1 apiv1.CallContext
}{arg1})
fake.recordInvocation("New", []interface{}{arg1})
fake.newMutex.Unlock()
if fake.NewStub != nil {
return fake.NewStub(arg1)
}
return fake.newReturns.result1, fake.newReturns.result2
}
func (fake *FakeCPIFactory) NewCallCount() int {
fake.newMutex.RLock()
defer fake.newMutex.RUnlock()
return len(fake.newArgsForCall)
}
func (fake *FakeCPIFactory) NewArgsForCall(i int) apiv1.CallContext {
fake.newMutex.RLock()
defer fake.newMutex.RUnlock()
return fake.newArgsForCall[i].arg1
}
func (fake *FakeCPIFactory) NewReturns(result1 apiv1.CPI, result2 error) {
fake.NewStub = nil
fake.newReturns = struct {
result1 apiv1.CPI
result2 error
}{result1, result2}
}
func (fake *FakeCPIFactory) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.newMutex.RLock()
defer fake.newMutex.RUnlock()
return fake.invocations
}
func (fake *FakeCPIFactory) 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 _ apiv1.CPIFactory = new(FakeCPIFactory)