@@ -37,25 +37,25 @@ func TestFinder_New(t *testing.T) {
3737func TestFinder_One (t * testing.T ) {
3838 testCases := []struct {
3939 name string
40- mock func (ctx context.Context , ctl * gomock.Controller ) iFinder [TestUser ]
40+ mock func (ctx context.Context , ctl * gomock.Controller ) IFinder [TestUser ]
4141 ctx context.Context
4242
4343 want * TestUser
4444 wantErr error
4545 }{
4646 {
4747 name : "error" ,
48- mock : func (ctx context.Context , ctl * gomock.Controller ) iFinder [TestUser ] {
49- mockCollection := mocks.NewMockiFinder [TestUser ](ctl )
48+ mock : func (ctx context.Context , ctl * gomock.Controller ) IFinder [TestUser ] {
49+ mockCollection := mocks.NewMockIFinder [TestUser ](ctl )
5050 mockCollection .EXPECT ().FindOne (gomock .Any ()).Return (nil , mongo .ErrNoDocuments ).Times (1 )
5151 return mockCollection
5252 },
5353 wantErr : mongo .ErrNoDocuments ,
5454 },
5555 {
5656 name : "match the first one" ,
57- mock : func (ctx context.Context , ctl * gomock.Controller ) iFinder [TestUser ] {
58- mockCollection := mocks.NewMockiFinder [TestUser ](ctl )
57+ mock : func (ctx context.Context , ctl * gomock.Controller ) IFinder [TestUser ] {
58+ mockCollection := mocks.NewMockIFinder [TestUser ](ctl )
5959 mockCollection .EXPECT ().FindOne (gomock .Any ()).Return (& TestUser {
6060 Name : "chenmingyong" ,
6161 Age : 24 ,
@@ -84,25 +84,25 @@ func TestFinder_One(t *testing.T) {
8484func TestFinder_All (t * testing.T ) {
8585 testCases := []struct {
8686 name string
87- mock func (ctx context.Context , ctl * gomock.Controller ) iFinder [TestUser ]
87+ mock func (ctx context.Context , ctl * gomock.Controller ) IFinder [TestUser ]
8888 ctx context.Context
8989
9090 want []* TestUser
9191 wantErr error
9292 }{
9393 {
9494 name : "empty documents" ,
95- mock : func (ctx context.Context , ctl * gomock.Controller ) iFinder [TestUser ] {
96- mockCollection := mocks.NewMockiFinder [TestUser ](ctl )
95+ mock : func (ctx context.Context , ctl * gomock.Controller ) IFinder [TestUser ] {
96+ mockCollection := mocks.NewMockIFinder [TestUser ](ctl )
9797 mockCollection .EXPECT ().Find (ctx ).Return ([]* TestUser {}, nil ).Times (1 )
9898 return mockCollection
9999 },
100100 want : []* TestUser {},
101101 },
102102 {
103103 name : "matched" ,
104- mock : func (ctx context.Context , ctl * gomock.Controller ) iFinder [TestUser ] {
105- mockCollection := mocks.NewMockiFinder [TestUser ](ctl )
104+ mock : func (ctx context.Context , ctl * gomock.Controller ) IFinder [TestUser ] {
105+ mockCollection := mocks.NewMockIFinder [TestUser ](ctl )
106106 mockCollection .EXPECT ().Find (ctx ).Return ([]* TestUser {
107107 {
108108 Name : "chenmingyong" ,
@@ -143,16 +143,16 @@ func TestFinder_All(t *testing.T) {
143143func TestFinder_Count (t * testing.T ) {
144144 testCases := []struct {
145145 name string
146- mock func (ctx context.Context , ctl * gomock.Controller ) iFinder [TestUser ]
146+ mock func (ctx context.Context , ctl * gomock.Controller ) IFinder [TestUser ]
147147 ctx context.Context
148148
149149 want int64
150150 wantErr error
151151 }{
152152 {
153153 name : "error" ,
154- mock : func (ctx context.Context , ctl * gomock.Controller ) iFinder [TestUser ] {
155- mockCollection := mocks.NewMockiFinder [TestUser ](ctl )
154+ mock : func (ctx context.Context , ctl * gomock.Controller ) IFinder [TestUser ] {
155+ mockCollection := mocks.NewMockIFinder [TestUser ](ctl )
156156 mockCollection .EXPECT ().Count (ctx ).Return (int64 (0 ), errors .New ("nil filter error" )).Times (1 )
157157 return mockCollection
158158 },
@@ -161,17 +161,17 @@ func TestFinder_Count(t *testing.T) {
161161 },
162162 {
163163 name : "matched 0" ,
164- mock : func (ctx context.Context , ctl * gomock.Controller ) iFinder [TestUser ] {
165- mockCollection := mocks.NewMockiFinder [TestUser ](ctl )
164+ mock : func (ctx context.Context , ctl * gomock.Controller ) IFinder [TestUser ] {
165+ mockCollection := mocks.NewMockIFinder [TestUser ](ctl )
166166 mockCollection .EXPECT ().Count (ctx ).Return (int64 (0 ), nil ).Times (1 )
167167 return mockCollection
168168 },
169169 want : 0 ,
170170 },
171171 {
172172 name : "matched 1" ,
173- mock : func (ctx context.Context , ctl * gomock.Controller ) iFinder [TestUser ] {
174- mockCollection := mocks.NewMockiFinder [TestUser ](ctl )
173+ mock : func (ctx context.Context , ctl * gomock.Controller ) IFinder [TestUser ] {
174+ mockCollection := mocks.NewMockIFinder [TestUser ](ctl )
175175 mockCollection .EXPECT ().Count (ctx ).Return (int64 (1 ), nil ).Times (1 )
176176 return mockCollection
177177 },
0 commit comments