-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmock_gen_test.go
189 lines (161 loc) · 5.21 KB
/
mock_gen_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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
// Code generated by my-nihongo-mockgen. DO NOT EDIT.
package mocking
import (
"context"
"github.com/stretchr/testify/mock"
"testing"
"time"
)
type fixtureImpl1Service struct {
ser1 *MockService1_1
ser2 *MockService2_1
}
// AssertExpectations asserts that everything specified with On and Return was in fact called as expected. Calls may have occurred in any order.
func (f *fixtureImpl1Service) AssertExpectations(t *testing.T) {
f.ser1.AssertExpectations(t)
f.ser2.AssertExpectations(t)
}
// createFixtureImpl1Service creates a new fixture with all mocks
func createFixtureImpl1Service() (Impl1Service, *fixtureImpl1Service) {
ser1 := new(MockService1_1)
ser2 := new(MockService2_1)
fixture := &impl1{ser1: ser1, ser2: ser2}
return fixture, &fixtureImpl1Service{ser1: ser1, ser2: ser2}
}
type MockService1_1 struct {
mock.Mock
}
func (m *MockService1_1) AssertBooNotCalled(t *testing.T, param string) {
m.AssertNotCalled(t, "Boo", param)
}
func (m *MockService1_1) Boo(param string) (uint64, error) {
ret := m.Called(param)
return ret.Get(0).(uint64), ret.Error(1)
}
func (m *MockService1_1) OnBoo(param string) *setup_MockService1_1_Boo {
call := m.On("Boo", param)
return &setup_MockService1_1_Boo{call: call}
}
type setup_MockService1_1_Boo struct {
call *mock.Call
}
func (s *setup_MockService1_1_Boo) Return(param1 uint64, param2 error) {
s.call.Return(param1, param2)
}
func (m *MockService1_1) AssertFooNotCalled(t *testing.T, param1 string, param2 int16) {
m.AssertNotCalled(t, "Foo", param1, param2)
}
func (m *MockService1_1) Foo(param1 string, param2 int16) string {
ret := m.Called(param1, param2)
return ret.String(0)
}
func (m *MockService1_1) OnFoo(param1 string, param2 int16) *setup_MockService1_1_Foo {
call := m.On("Foo", param1, param2)
return &setup_MockService1_1_Foo{call: call}
}
type setup_MockService1_1_Foo struct {
call *mock.Call
}
func (s *setup_MockService1_1_Foo) Return(param1 string) {
s.call.Return(param1)
}
type MockService2_1 struct {
mock.Mock
}
func (m *MockService2_1) AssertFooNotCalled(t *testing.T, arg1 string, arg2 string) {
m.AssertNotCalled(t, "Foo", arg1, arg2)
}
func (m *MockService2_1) Foo(arg1 string, arg2 string) (string, int, error) {
ret := m.Called(arg1, arg2)
return ret.String(0), ret.Int(1), ret.Error(2)
}
func (m *MockService2_1) OnFoo(arg1 string, arg2 string) *setup_MockService2_1_Foo {
call := m.On("Foo", arg1, arg2)
return &setup_MockService2_1_Foo{call: call}
}
type setup_MockService2_1_Foo struct {
call *mock.Call
}
func (s *setup_MockService2_1_Foo) Return(param1 string, param2 int, param3 error) {
s.call.Return(param1, param2, param3)
}
type fixtureImpl2Service struct {
ser11 *MockService1_2
ser3 *MockService2_1
}
// AssertExpectations asserts that everything specified with On and Return was in fact called as expected. Calls may have occurred in any order.
func (f *fixtureImpl2Service) AssertExpectations(t *testing.T) {
f.ser11.AssertExpectations(t)
f.ser3.AssertExpectations(t)
}
// createFixtureImpl2Service creates a new fixture with all mocks
func createFixtureImpl2Service() (Impl2Service, *fixtureImpl2Service) {
ser11 := new(MockService1_2)
ser3 := new(MockService2_1)
fixture := &impl2{ser11: ser11, ser3: ser3}
return fixture, &fixtureImpl2Service{ser11: ser11, ser3: ser3}
}
type MockService1_2 struct {
mock.Mock
}
func (m *MockService1_2) AssertBooNotCalled(t *testing.T, param string) {
m.AssertNotCalled(t, "Boo", param)
}
func (m *MockService1_2) Boo(param string) {
m.Called(param)
return
}
func (m *MockService1_2) OnBoo(param string) {
m.On("Boo", param)
return
}
func (m *MockService1_2) AssertFooNotCalled(t *testing.T, param1 string, param2 int16) {
m.AssertNotCalled(t, "Foo", param1, param2)
}
func (m *MockService1_2) Foo(param1 string, param2 int16) (int, bool) {
ret := m.Called(param1, param2)
return ret.Int(0), ret.Bool(1)
}
func (m *MockService1_2) OnFoo(param1 string, param2 int16) *setup_MockService1_2_Foo {
call := m.On("Foo", param1, param2)
return &setup_MockService1_2_Foo{call: call}
}
type setup_MockService1_2_Foo struct {
call *mock.Call
}
func (s *setup_MockService1_2_Foo) Return(param1 int, param2 bool) {
s.call.Return(param1, param2)
}
type fixtureImpl3 struct {
ser1 *MockService2_2
}
// AssertExpectations asserts that everything specified with On and Return was in fact called as expected. Calls may have occurred in any order.
func (f *fixtureImpl3) AssertExpectations(t *testing.T) {
f.ser1.AssertExpectations(t)
}
// createFixtureImpl3 creates a new fixture with all mocks
func createFixtureImpl3() (*impl3, *fixtureImpl3) {
ser1 := new(MockService2_2)
fixture := &impl3{ser1: ser1}
return fixture, &fixtureImpl3{ser1: ser1}
}
type MockService2_2 struct {
mock.Mock
}
func (m *MockService2_2) AssertNowNotCalled(t *testing.T, ctx context.Context) {
m.AssertNotCalled(t, "Now", ctx)
}
func (m *MockService2_2) Now(ctx context.Context) time.Time {
ret := m.Called(ctx)
return ret.Get(0).(time.Time)
}
func (m *MockService2_2) OnNow(ctx context.Context) *setup_MockService2_2_Now {
call := m.On("Now", ctx)
return &setup_MockService2_2_Now{call: call}
}
type setup_MockService2_2_Now struct {
call *mock.Call
}
func (s *setup_MockService2_2_Now) Return(param1 time.Time) {
s.call.Return(param1)
}