I have a class that depends on querying contacts data.  It's not an
activity, service, content provider or anything like that (although it
may be used by one) - it just accepts a Context object at construction
time and gets a content resolver from that to do queries.  It's
effectively a layer on top of ContactsContract and I'd like to test
that this layer does its job of translating contacts data into the
format that I want by pre-populating specific RawContacts records and
verifying the output.

What I think would be ideal is the type of thing that the
ProviderTestCase2 class provides me when I am testing my own content
providers.  It looks like database operations are done in such a way
that the data is not persisted between test runs (or even between
individual tests) and it is not available outside the testing context.

Does anyone know if I can put together a test using the existing
testing framework that will perform similar data isolation with
contacts?  It doesn't look like I could leverage ProviderTestCase2
since it's not my provider that I'm using in the test.

Will I be forced to just manage the contacts data manually during
testing?  I suppose I could do something like mark all the RawContacts
I insert with a special account name/type and clean them out between
tests.

Suggestions welcome. Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to