You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Keith Hyland <kh...@aol.com> on 2005/01/27 10:57:31 UTC
Mocking httpclient for unit testing...
Hi,
I'm trying to wrtie a unit test around a module that uses httpclient.
Ideally I'd like to mock up the actual connection out of my system since
this is not the functionaliy I want to test.
I've seen other approaches with the basic socket library where
connections and socket classes were mocked and supplied directly to the
class under test. That way the mock implementation doesn't make any
connection at all. But I don't see how to do this with httpclient.
One option would be to mock the complete Httpclient and GetMethod that I
use.
What approaches do people use for this?
The alternative is that I need to start up a webserver as part of my
test suite, and get httpClient to connect to that? But this seems a
little messy.
Cheers,
Keith
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: Mocking httpclient for unit testing...
Posted by Roland Weber <RO...@de.ibm.com>.
Hi Keith,
have a look at o.a.c.h.protocol.ProtocolSocketFactory.
cheers,
Roland
"Keith Hyland" <kh...@aol.com>
27.01.2005 10:57
Please respond to
"HttpClient User Discussion"
To
"HttpClient User Discussion" <ht...@jakarta.apache.org>
cc
Subject
Mocking httpclient for unit testing...
Hi,
I'm trying to wrtie a unit test around a module that uses httpclient.
Ideally I'd like to mock up the actual connection out of my system since
this is not the functionaliy I want to test.
I've seen other approaches with the basic socket library where
connections and socket classes were mocked and supplied directly to the
class under test. That way the mock implementation doesn't make any
connection at all. But I don't see how to do this with httpclient.
One option would be to mock the complete Httpclient and GetMethod that I
use.
What approaches do people use for this?
The alternative is that I need to start up a webserver as part of my
test suite, and get httpClient to connect to that? But this seems a
little messy.
Cheers,
Keith
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org