jostyee / gomock

Automatically exported from code.google.com/p/gomock
Apache License 2.0
0 stars 0 forks source link

Allow for loose mocks #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Loose mocks, i.e. mocks that simply return defaults for unexpected methods are 
fairly common in other mock frameworks. I experimentally added this to gomock 
and it seems to work. By allowing this I can skip the following call in my test:

storer.EXPECT().Allocate(gomock.Any(), gomock.Any()).AnyTimes()

In this case the storer is a mocked dependency of my SUT which I don't care 
about in this particular test. The default of it returning nil for the single 
error return is fine.

Original issue reported on code.google.com by andre.na...@gmail.com on 4 Mar 2014 at 9:24

GoogleCodeExporter commented 9 years ago
Should have been an enhancement

Original comment by andre.na...@gmail.com on 4 Mar 2014 at 9:37