On 25 June 2011 17:34, KARR, DAVID (ATTSI) <dk0...@att.com> wrote: >> -----Original Message----- >> From: Miguel Paraz [mailto:mpa...@gmail.com] >> Sent: Saturday, June 25, 2011 12:48 AM >> To: HttpClient User Discussion >> Subject: Feasibility of Mocking HttpClient >> >> Hi, >> >> Is it feasible to mock HttpClient, with a mocking framework or with >> custom implementations of the classes? >> I would like to unit test my code that uses HttpClient, without going >> out to the network (even if it's just localhost). > > Mocking frameworks can mock almost anything. Just take a look at Mockito or > similar frameworks and you'll see how it's done. Your job might be easier if > your use of HttpClient was encapsulated in an application-specific layer that > only performs that function, as it will likely be easier to mock that layer > instead of HttpClient.
Also have a look at the HC Unit tests - they use Mockito for some tests. > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org > For additional commands, e-mail: httpclient-users-h...@hc.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org