I have an Android service that I would like to test in an instrumentation test. The service requires access to a content provider and uses a content resolver for that purpose.
In instrumentation tests I need to use a mock content resolver, which I can acquire from a ProviderTestCase2. The problem now is it is impossible to inject dependencies into a service upon creation and thus it is impossible to inject the content resolver to exchange it for the mock content resolver as part of a test case.
Does anyone have a satisfying solution for this problem?
Aucun commentaire:
Enregistrer un commentaire