Adding Smarts to Our Stub: Verifying Parameters
Our Http stub always returns the same hardcoded JSON string, regardless of the latitude and longitude passed to its get() method. That’s a small hole in testing. If the AddressRetriever doesn’t pass the parameters correctly, we have a defect.
“How hard can it be to pass a couple arguments correctly to a function?” asks Pat. “Do we really need to test that?”
Dale says, “You’re forgetting when we shipped code the other week where someone inadvertently swapped the order of the latitude and longitude in another part of the system. We wasted a couple hours on that defect.”
Here’s another way to think about what we’re doing: we’re not exercising the real behavior of HttpImpl, but we know that other ...