|
1 | | -// Code generated by MockGen. DO NOT EDIT. |
2 | | -// Source: context.go |
3 | | -// |
4 | | -// Generated by this command: |
5 | | -// |
6 | | -// mockgen -package chasm -source context.go -destination context_mock.go |
7 | | -// |
8 | | - |
9 | | -// Package chasm is a generated GoMock package. |
10 | 1 | package chasm |
11 | 2 |
|
12 | 3 | import ( |
13 | | - context "context" |
14 | | - reflect "reflect" |
15 | | - time "time" |
16 | | - |
17 | | - gomock "go.uber.org/mock/gomock" |
| 4 | + "context" |
| 5 | + "sync" |
| 6 | + "time" |
18 | 7 | ) |
19 | 8 |
|
20 | | -// MockContext is a mock of Context interface. |
| 9 | +// MockContext is a mock implementation of [Context]. |
21 | 10 | type MockContext struct { |
22 | | - ctrl *gomock.Controller |
23 | | - recorder *MockContextMockRecorder |
24 | | - isgomock struct{} |
25 | | -} |
26 | | - |
27 | | -// MockContextMockRecorder is the mock recorder for MockContext. |
28 | | -type MockContextMockRecorder struct { |
29 | | - mock *MockContext |
30 | | -} |
31 | | - |
32 | | -// NewMockContext creates a new mock instance. |
33 | | -func NewMockContext(ctrl *gomock.Controller) *MockContext { |
34 | | - mock := &MockContext{ctrl: ctrl} |
35 | | - mock.recorder = &MockContextMockRecorder{mock} |
36 | | - return mock |
37 | | -} |
38 | | - |
39 | | -// EXPECT returns an object that allows the caller to indicate expected use. |
40 | | -func (m *MockContext) EXPECT() *MockContextMockRecorder { |
41 | | - return m.recorder |
| 11 | + HandleExecutionKey func() EntityKey |
| 12 | + HandleNow func(component Component) time.Time |
| 13 | + HandleRef func(component Component) ([]byte, error) |
42 | 14 | } |
43 | 15 |
|
44 | | -// Now mocks base method. |
45 | | -func (m *MockContext) Now(arg0 Component) time.Time { |
46 | | - m.ctrl.T.Helper() |
47 | | - ret := m.ctrl.Call(m, "Now", arg0) |
48 | | - ret0, _ := ret[0].(time.Time) |
49 | | - return ret0 |
| 16 | +func (c *MockContext) getContext() context.Context { |
| 17 | + return nil |
50 | 18 | } |
51 | 19 |
|
52 | | -// Now indicates an expected call of Now. |
53 | | -func (mr *MockContextMockRecorder) Now(arg0 any) *gomock.Call { |
54 | | - mr.mock.ctrl.T.Helper() |
55 | | - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Now", reflect.TypeOf((*MockContext)(nil).Now), arg0) |
| 20 | +func (c *MockContext) Now(cmp Component) time.Time { |
| 21 | + if c.HandleNow != nil { |
| 22 | + return c.HandleNow(cmp) |
| 23 | + } |
| 24 | + return time.Now() |
56 | 25 | } |
57 | 26 |
|
58 | | -// Ref mocks base method. |
59 | | -func (m *MockContext) Ref(arg0 Component) ([]byte, error) { |
60 | | - m.ctrl.T.Helper() |
61 | | - ret := m.ctrl.Call(m, "Ref", arg0) |
62 | | - ret0, _ := ret[0].([]byte) |
63 | | - ret1, _ := ret[1].(error) |
64 | | - return ret0, ret1 |
| 27 | +func (c *MockContext) Ref(cmp Component) ([]byte, error) { |
| 28 | + if c.HandleRef != nil { |
| 29 | + return c.HandleRef(cmp) |
| 30 | + } |
| 31 | + return nil, nil |
65 | 32 | } |
66 | 33 |
|
67 | | -// Ref indicates an expected call of Ref. |
68 | | -func (mr *MockContextMockRecorder) Ref(arg0 any) *gomock.Call { |
69 | | - mr.mock.ctrl.T.Helper() |
70 | | - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ref", reflect.TypeOf((*MockContext)(nil).Ref), arg0) |
| 34 | +func (c *MockContext) ExecutionKey() EntityKey { |
| 35 | + if c.HandleExecutionKey != nil { |
| 36 | + return c.HandleExecutionKey() |
| 37 | + } |
| 38 | + return EntityKey{} |
71 | 39 | } |
72 | 40 |
|
73 | | -// getContext mocks base method. |
74 | | -func (m *MockContext) getContext() context.Context { |
75 | | - m.ctrl.T.Helper() |
76 | | - ret := m.ctrl.Call(m, "getContext") |
77 | | - ret0, _ := ret[0].(context.Context) |
78 | | - return ret0 |
79 | | -} |
80 | | - |
81 | | -// getContext indicates an expected call of getContext. |
82 | | -func (mr *MockContextMockRecorder) getContext() *gomock.Call { |
83 | | - mr.mock.ctrl.T.Helper() |
84 | | - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "getContext", reflect.TypeOf((*MockContext)(nil).getContext)) |
85 | | -} |
86 | | - |
87 | | -// MockMutableContext is a mock of MutableContext interface. |
| 41 | +// MockMutableContext is a mock implementation of [MutableContext] that records added tasks for inspection in |
| 42 | +// tests. |
88 | 43 | type MockMutableContext struct { |
89 | | - ctrl *gomock.Controller |
90 | | - recorder *MockMutableContextMockRecorder |
91 | | - isgomock struct{} |
92 | | -} |
93 | | - |
94 | | -// MockMutableContextMockRecorder is the mock recorder for MockMutableContext. |
95 | | -type MockMutableContextMockRecorder struct { |
96 | | - mock *MockMutableContext |
97 | | -} |
98 | | - |
99 | | -// NewMockMutableContext creates a new mock instance. |
100 | | -func NewMockMutableContext(ctrl *gomock.Controller) *MockMutableContext { |
101 | | - mock := &MockMutableContext{ctrl: ctrl} |
102 | | - mock.recorder = &MockMutableContextMockRecorder{mock} |
103 | | - return mock |
104 | | -} |
105 | | - |
106 | | -// EXPECT returns an object that allows the caller to indicate expected use. |
107 | | -func (m *MockMutableContext) EXPECT() *MockMutableContextMockRecorder { |
108 | | - return m.recorder |
109 | | -} |
110 | | - |
111 | | -// AddTask mocks base method. |
112 | | -func (m *MockMutableContext) AddTask(arg0 Component, arg1 TaskAttributes, arg2 any) { |
113 | | - m.ctrl.T.Helper() |
114 | | - m.ctrl.Call(m, "AddTask", arg0, arg1, arg2) |
115 | | -} |
116 | | - |
117 | | -// AddTask indicates an expected call of AddTask. |
118 | | -func (mr *MockMutableContextMockRecorder) AddTask(arg0, arg1, arg2 any) *gomock.Call { |
119 | | - mr.mock.ctrl.T.Helper() |
120 | | - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddTask", reflect.TypeOf((*MockMutableContext)(nil).AddTask), arg0, arg1, arg2) |
121 | | -} |
122 | | - |
123 | | -// Now mocks base method. |
124 | | -func (m *MockMutableContext) Now(arg0 Component) time.Time { |
125 | | - m.ctrl.T.Helper() |
126 | | - ret := m.ctrl.Call(m, "Now", arg0) |
127 | | - ret0, _ := ret[0].(time.Time) |
128 | | - return ret0 |
129 | | -} |
130 | | - |
131 | | -// Now indicates an expected call of Now. |
132 | | -func (mr *MockMutableContextMockRecorder) Now(arg0 any) *gomock.Call { |
133 | | - mr.mock.ctrl.T.Helper() |
134 | | - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Now", reflect.TypeOf((*MockMutableContext)(nil).Now), arg0) |
135 | | -} |
136 | | - |
137 | | -// Ref mocks base method. |
138 | | -func (m *MockMutableContext) Ref(arg0 Component) ([]byte, error) { |
139 | | - m.ctrl.T.Helper() |
140 | | - ret := m.ctrl.Call(m, "Ref", arg0) |
141 | | - ret0, _ := ret[0].([]byte) |
142 | | - ret1, _ := ret[1].(error) |
143 | | - return ret0, ret1 |
144 | | -} |
| 44 | + MockContext |
145 | 45 |
|
146 | | -// Ref indicates an expected call of Ref. |
147 | | -func (mr *MockMutableContextMockRecorder) Ref(arg0 any) *gomock.Call { |
148 | | - mr.mock.ctrl.T.Helper() |
149 | | - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ref", reflect.TypeOf((*MockMutableContext)(nil).Ref), arg0) |
| 46 | + mu sync.Mutex |
| 47 | + Tasks []MockTask |
150 | 48 | } |
151 | 49 |
|
152 | | -// getContext mocks base method. |
153 | | -func (m *MockMutableContext) getContext() context.Context { |
154 | | - m.ctrl.T.Helper() |
155 | | - ret := m.ctrl.Call(m, "getContext") |
156 | | - ret0, _ := ret[0].(context.Context) |
157 | | - return ret0 |
| 50 | +func (c *MockMutableContext) AddTask(component Component, attributes TaskAttributes, payload any) { |
| 51 | + c.mu.Lock() |
| 52 | + defer c.mu.Unlock() |
| 53 | + c.Tasks = append(c.Tasks, MockTask{component, attributes, payload}) |
158 | 54 | } |
159 | 55 |
|
160 | | -// getContext indicates an expected call of getContext. |
161 | | -func (mr *MockMutableContextMockRecorder) getContext() *gomock.Call { |
162 | | - mr.mock.ctrl.T.Helper() |
163 | | - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "getContext", reflect.TypeOf((*MockMutableContext)(nil).getContext)) |
| 56 | +type MockTask struct { |
| 57 | + Component Component |
| 58 | + Attributes TaskAttributes |
| 59 | + Payload any |
164 | 60 | } |
0 commit comments