forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_fingerprinter.go
89 lines (79 loc) · 2.44 KB
/
fake_fingerprinter.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
78
79
80
81
82
83
84
85
86
87
88
89
// This file was generated by counterfeiter
package resourcefakes
import (
"sync"
"github.com/cloudfoundry/bosh-cli/release/resource"
)
type FakeFingerprinter struct {
CalculateStub func([]resource.File, []string) (string, error)
calculateMutex sync.RWMutex
calculateArgsForCall []struct {
arg1 []resource.File
arg2 []string
}
calculateReturns struct {
result1 string
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeFingerprinter) Calculate(arg1 []resource.File, arg2 []string) (string, error) {
var arg1Copy []resource.File
if arg1 != nil {
arg1Copy = make([]resource.File, len(arg1))
copy(arg1Copy, arg1)
}
var arg2Copy []string
if arg2 != nil {
arg2Copy = make([]string, len(arg2))
copy(arg2Copy, arg2)
}
fake.calculateMutex.Lock()
fake.calculateArgsForCall = append(fake.calculateArgsForCall, struct {
arg1 []resource.File
arg2 []string
}{arg1Copy, arg2Copy})
fake.recordInvocation("Calculate", []interface{}{arg1Copy, arg2Copy})
fake.calculateMutex.Unlock()
if fake.CalculateStub != nil {
return fake.CalculateStub(arg1, arg2)
}
return fake.calculateReturns.result1, fake.calculateReturns.result2
}
func (fake *FakeFingerprinter) CalculateCallCount() int {
fake.calculateMutex.RLock()
defer fake.calculateMutex.RUnlock()
return len(fake.calculateArgsForCall)
}
func (fake *FakeFingerprinter) CalculateArgsForCall(i int) ([]resource.File, []string) {
fake.calculateMutex.RLock()
defer fake.calculateMutex.RUnlock()
return fake.calculateArgsForCall[i].arg1, fake.calculateArgsForCall[i].arg2
}
func (fake *FakeFingerprinter) CalculateReturns(result1 string, result2 error) {
fake.CalculateStub = nil
fake.calculateReturns = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeFingerprinter) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.calculateMutex.RLock()
defer fake.calculateMutex.RUnlock()
return fake.invocations
}
func (fake *FakeFingerprinter) 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 _ resource.Fingerprinter = new(FakeFingerprinter)