How can I use a real application object with Android ServiceTestCase

I am trying to test a service that requires a real Application object, not the MockApplication provided by ServiceTestCase.

How to create a real application object in ServiceTestCase?

+3
source share
1 answer

A service has two own dependencies, its Contextand related Application. The structure ServiceTestCaseallows you to introduce these dependencies and thus run unit tests with controlled dependencies in an isolated environment.

Application , , , ServiceTestCase.setApplication().

0

All Articles