Question

I have a sync adapter that is synchronizing the contacts with a private server. It looks something like the SampleSyncAdapter in the samples (but of course modified to meet my needs).

I need to write tests for this sync adapter. Can anyone give me some guides on how to write these tests?

I got stuck with testing the contacts operations (create, update, delete). How can I mock the contacts database so I can that one for testing instead of the the real contacts database?

Thank you

Was it helpful?

Solution

I couldn't find solution for this, so I decided to create new account in setUp(), run the tests and delete the account at the end. This way I can test the operations with the real database but in different account. So I can run my tests, but without changing the existing contacts.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top