Simplifying Testing using a Mock Tool
Let's learn to simplify tests using the Mock tool.
We'll cover the following...
Transforming stub into mock
Let’s consider how to transform our smart stub into a mock. To do so would involve:
- Trapping and storing the parameters passed to the
get()method. - Supporting the ability to verify upon test completion that the stored parameters to
get()contains the expect parameters.
Creating a mock that performs those steps may seem like overkill. What does it get us? Actually, not much at all. If we were to write a second or third test ...
Ask