views:

43

answers:

0

I've written my own Android ContentProvider for accessing certain Internet resources. I'm trying to write some unit tests, but I do not want those tests to actually access the Internet.

Behind the scenes, my code is using the DefaultHttpClient class to access the web. Basically, I'd like to know how I can use the ProviderTestCase2 class to intercept any HTTP requests and return a predefined String "response" instead.

I'm assuming there is something I can mock inside either ContentResolver or Context to do this, but I need a bit of guidance.