I started by refactoring to create a dependency injection seam [63797de]. The idea was to inject an HttpClient
mock that would allow me to inspect the resulting argument to its execute()
method in retrieve-Response()
. To that end, I elevated the HttpClient
instance to a class field initialized in the default constructor, which I now needed to make explicit. I then factored out a constructor that took an HttpClient
instance as an argument and reworked the default constructor to chain to the new one, passing a fresh instance.
In writing the test to exploit the seam, I discovered that many of the methods of DefaultHttpClient
and AbstractHttpClient
, including the single-argument version of execute()
that the code uses, are final, preventing override and therefore obviating the injection approach. Commit [03e0517] removed the new constructor but kept the new version of the default constructor and left the HttpClient
instance as a field.
3.136.17.139