File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -433,13 +433,14 @@ throwOnMissingStub(cat);
433
433
434
434
Testing with real objects is preferred over testing with mocks - if you can
435
435
construct a real instance for your tests, you should! If there are no calls to
436
- [ ` verify ` ] in your test, it is a strong signal that you may not need mocks at all,
437
- though it's also OK to use a ` Mock ` like a stub. When it's not possible to use
438
- the real object, a tested implementation of a fake is the next best thing - it's
439
- more likely to behave similarly to the real class than responses stubbed out in
440
- tests. Finally an object which ` extends Fake ` using manually overridden methods
441
- is preferred over an object which ` extends Mock ` used as either a stub or a
442
- mock.
436
+ [ ` verify ` ] in your test, it is a strong signal that you may not need mocks at
437
+ all, though it's also OK to use a ` Mock ` like a stub. Data models never need to
438
+ be mocked if they can be constructed with stubbed data. When it's not possible
439
+ to use the real object, a tested implementation of a fake is the next best
440
+ thing; it's more likely to behave similarly to the real class than responses
441
+ stubbed out in tests. Finally an object which ` extends Fake ` using manually
442
+ overridden methods is preferred over an object which ` extends Mock ` used as
443
+ either a stub or a mock.
443
444
444
445
A class which ` extends Mock ` should _ never_ stub out its own responses with
445
446
` when ` in its constructor or anywhere else. Stubbed responses should be defined
You can’t perform that action at this time.
0 commit comments