-
Notifications
You must be signed in to change notification settings - Fork 0
/
double.go
94 lines (78 loc) · 3.67 KB
/
double.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
// Code generated by go doublegen; DO NOT EDIT.
// This file was generated at 2020-02-14T22:14:18+11:00
// Package personalizeeventsdouble provides a TestDouble implementation of personalizeeventsiface.PersonalizeEventsAPI
package personalizeeventsdouble
import (
"context"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/personalizeevents"
"github.com/aws/aws-sdk-go/service/personalizeevents/personalizeeventsiface"
"github.com/lwoggardner/awsdouble"
"github.com/lwoggardner/godouble/godouble"
)
// PersonalizeEventsDouble is TestDouble for personalizeeventsiface.PersonalizeEventsAPI
type PersonalizeEventsDouble struct {
personalizeeventsiface.PersonalizeEventsAPI
*awsdouble.AWSTestDouble
}
// Constructor for PersonalizeEventsDouble
// Default configuration will ensure
// * API operations not explicitly stubbed will return an empty output struct pointer, and nil error.
// To simulate long polling, "Poll" operations will return these values after a random delay of up to 100ms.
// * WithContext methods implement a 'Fake' method that returns a cancellation error if the context is cancelled
// before the method is called.
// * Pages and PagesWithContext methods similarly implement a 'Fake' method that paginates over the underlying method.
//
// This allows tests to only stub the simple api methods and be generally unconcerned whether the SUT is using the
// Context or Pagination forms of the API.
//
func NewDouble(t godouble.T, configurators ...func(*awsdouble.AWSTestDouble)) *PersonalizeEventsDouble {
result := &PersonalizeEventsDouble{}
configurators = append([]func(configurator *awsdouble.AWSTestDouble){func(d *awsdouble.AWSTestDouble) {
d.SetDefaultCall(result.defaultMethodCall)
d.SetDefaultReturnValues(result.defaultReturnValues)
}}, configurators...)
result.AWSTestDouble = awsdouble.NewDouble(t, (*personalizeeventsiface.PersonalizeEventsAPI)(nil), configurators...)
return result
}
func (d *PersonalizeEventsDouble) defaultReturnValues(m godouble.Method) godouble.ReturnValues {
return d.DefaultReturnValues(m)
}
func (d *PersonalizeEventsDouble) defaultMethodCall(m godouble.Method) godouble.MethodCall {
switch m.Reflect().Name {
case "PutEventsWithContext":
return m.Fake(d.fakePutEventsWithContext)
default:
return nil
}
}
func (d *PersonalizeEventsDouble) PutEvents(i0 *personalizeevents.PutEventsInput) (r0 *personalizeevents.PutEventsOutput, r1 error) {
d.TestDouble.T().Helper()
returns := d.TestDouble.Invoke("PutEvents", i0)
r0, _ = returns[0].(*personalizeevents.PutEventsOutput)
r1, _ = returns[1].(error)
return
}
func (d *PersonalizeEventsDouble) PutEventsRequest(i0 *personalizeevents.PutEventsInput) (r0 *request.Request, r1 *personalizeevents.PutEventsOutput) {
d.TestDouble.T().Helper()
returns := d.TestDouble.Invoke("PutEventsRequest", i0)
r0, _ = returns[0].(*request.Request)
r1, _ = returns[1].(*personalizeevents.PutEventsOutput)
return
}
func (d *PersonalizeEventsDouble) PutEventsWithContext(i0 context.Context, i1 *personalizeevents.PutEventsInput, i2 ...request.Option) (r0 *personalizeevents.PutEventsOutput, r1 error) {
d.TestDouble.T().Helper()
returns := d.TestDouble.Invoke("PutEventsWithContext", i0, i1, i2)
r0, _ = returns[0].(*personalizeevents.PutEventsOutput)
r1, _ = returns[1].(error)
return
}
func (d *PersonalizeEventsDouble) fakePutEventsWithContext(ctx context.Context, in *personalizeevents.PutEventsInput, _ ...request.Option) (*personalizeevents.PutEventsOutput, error) {
select {
case <-ctx.Done():
return nil, awserr.New(request.CanceledErrorCode, "PutEvents cancelled", ctx.Err())
default:
return d.PutEvents(in)
}
}