October 2013
Intermediate to advanced
368 pages
9h 20m
English
Test doubles are like any tool; the bigger challenge is not in learning how to use them but in knowing when to use them. This section describes a few schools of thought and provides some recommendations for appropriate use of test doubles.
Suppose AddressExtractor does not exist. When you test-drive
summaryDescription
, you’ll of course recognize the need for logic that takes a JSON response and ultimately returns a formatted string. You could code the entire implementation for that in the PlaceDescriptionService. It’s not much code (a little more than a dozen lines, based on the code in AddressExtractor as it exists).
Some programmers always wear the designer hat, seeking designs that exhibit ...