forked from cloudfoundry-incubator/bits-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmock_updater_test.go
173 lines (150 loc) · 6.07 KB
/
mock_updater_test.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// Code generated by pegomock. DO NOT EDIT.
// Source: github.com/cloudfoundry-incubator/bits-service (interfaces: Updater)
package bitsgo_test
import (
pegomock "github.com/petergtz/pegomock"
"reflect"
)
type MockUpdater struct {
fail func(message string, callerSkip ...int)
}
func NewMockUpdater() *MockUpdater {
return &MockUpdater{fail: pegomock.GlobalFailHandler}
}
func (mock *MockUpdater) NotifyProcessingUpload(guid string) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockMockUpdater().")
}
params := []pegomock.Param{guid}
result := pegomock.GetGenericMockFrom(mock).Invoke("NotifyProcessingUpload", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
}
}
return ret0
}
func (mock *MockUpdater) NotifyUploadSucceeded(guid string, sha1 string, sha2 string) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockMockUpdater().")
}
params := []pegomock.Param{guid, sha1, sha2}
result := pegomock.GetGenericMockFrom(mock).Invoke("NotifyUploadSucceeded", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
}
}
return ret0
}
func (mock *MockUpdater) NotifyUploadFailed(guid string, e error) error {
if mock == nil {
panic("mock must not be nil. Use myMock := NewMockMockUpdater().")
}
params := []pegomock.Param{guid, e}
result := pegomock.GetGenericMockFrom(mock).Invoke("NotifyUploadFailed", params, []reflect.Type{reflect.TypeOf((*error)(nil)).Elem()})
var ret0 error
if len(result) != 0 {
if result[0] != nil {
ret0 = result[0].(error)
}
}
return ret0
}
func (mock *MockUpdater) VerifyWasCalledOnce() *VerifierUpdater {
return &VerifierUpdater{mock, pegomock.Times(1), nil}
}
func (mock *MockUpdater) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierUpdater {
return &VerifierUpdater{mock, invocationCountMatcher, nil}
}
func (mock *MockUpdater) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierUpdater {
return &VerifierUpdater{mock, invocationCountMatcher, inOrderContext}
}
type VerifierUpdater struct {
mock *MockUpdater
invocationCountMatcher pegomock.Matcher
inOrderContext *pegomock.InOrderContext
}
func (verifier *VerifierUpdater) NotifyProcessingUpload(guid string) *Updater_NotifyProcessingUpload_OngoingVerification {
params := []pegomock.Param{guid}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NotifyProcessingUpload", params)
return &Updater_NotifyProcessingUpload_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Updater_NotifyProcessingUpload_OngoingVerification struct {
mock *MockUpdater
methodInvocations []pegomock.MethodInvocation
}
func (c *Updater_NotifyProcessingUpload_OngoingVerification) GetCapturedArguments() string {
guid := c.GetAllCapturedArguments()
return guid[len(guid)-1]
}
func (c *Updater_NotifyProcessingUpload_OngoingVerification) GetAllCapturedArguments() (_param0 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
for u, param := range params[0] {
_param0[u] = param.(string)
}
}
return
}
func (verifier *VerifierUpdater) NotifyUploadSucceeded(guid string, sha1 string, sha2 string) *Updater_NotifyUploadSucceeded_OngoingVerification {
params := []pegomock.Param{guid, sha1, sha2}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NotifyUploadSucceeded", params)
return &Updater_NotifyUploadSucceeded_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Updater_NotifyUploadSucceeded_OngoingVerification struct {
mock *MockUpdater
methodInvocations []pegomock.MethodInvocation
}
func (c *Updater_NotifyUploadSucceeded_OngoingVerification) GetCapturedArguments() (string, string, string) {
guid, sha1, sha2 := c.GetAllCapturedArguments()
return guid[len(guid)-1], sha1[len(sha1)-1], sha2[len(sha2)-1]
}
func (c *Updater_NotifyUploadSucceeded_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []string, _param2 []string) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
for u, param := range params[0] {
_param0[u] = param.(string)
}
_param1 = make([]string, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.(string)
}
_param2 = make([]string, len(params[2]))
for u, param := range params[2] {
_param2[u] = param.(string)
}
}
return
}
func (verifier *VerifierUpdater) NotifyUploadFailed(guid string, e error) *Updater_NotifyUploadFailed_OngoingVerification {
params := []pegomock.Param{guid, e}
methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "NotifyUploadFailed", params)
return &Updater_NotifyUploadFailed_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations}
}
type Updater_NotifyUploadFailed_OngoingVerification struct {
mock *MockUpdater
methodInvocations []pegomock.MethodInvocation
}
func (c *Updater_NotifyUploadFailed_OngoingVerification) GetCapturedArguments() (string, error) {
guid, e := c.GetAllCapturedArguments()
return guid[len(guid)-1], e[len(e)-1]
}
func (c *Updater_NotifyUploadFailed_OngoingVerification) GetAllCapturedArguments() (_param0 []string, _param1 []error) {
params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations)
if len(params) > 0 {
_param0 = make([]string, len(params[0]))
for u, param := range params[0] {
_param0[u] = param.(string)
}
_param1 = make([]error, len(params[1]))
for u, param := range params[1] {
_param1[u] = param.(error)
}
}
return
}