March 2015
Intermediate to advanced
236 pages
5h 26m
English
We consider transforming our smart stub into a mock as the next step. To do so would involve:
Specifying in the test which parameters we expected (as opposed to within the stub itself)
Trapping and storing the parameters passed to the get() method
Supporting the ability to verify upon test completion that the stored parameters to get() contain the expected parameters
Creating a mock that performs those steps seems like overkill. What does it buy us? Actually, not much at all. But if we were to write a second or third test that used the same mock, we’d shrink the amount of code we’d need to write for each.
And if we created more mock implementations for other troublesome dependencies, we’d find a way to refactor ...
Read now
Unlock full access