November 2024
Intermediate to advanced
300 pages
7h 12m
English
Your HTTP stub always returns the same hardcoded JSON string, regardless of the latitude/longitude passed to get. That’s a small hole in testing. If the AddressRetriever doesn’t pass the parameters properly, you have a defect.
You are not exercising the real behavior of HttpImpl (which already has tests). You’re exercising the rest of retrieve’s code based on a return value that HttpImpl might cough up. The only thing left to cover is verifying that retrieve correctly interacts with HttpImpl.
As a quick stab at a solution, add a guard clause to the stub that verifies the URL passed to the HTTP method get. If it doesn’t contain the expected parameter string, explicitly fail the test at that point: ...
Read now
Unlock full access