According to this other question, it is possible to start an Activity
from a Service
.
How can I, in a ServiceTestCase
, unit test that the correct Intent
is passed to startActivity()
?
ActivityUnitTestCase
has the useful method getStartedActivityIntent()
. And I've been able to test the converse—that an Activity
started a Service
—in an ActivityUnitTestCase
by passing a ContextWrapper
into its setActivityContext()
method, like in this other question.
But ServiceTestCase
seems to have no equivalents for getStartedActivityIntent()
or setActivityContext()
that would help me here. What can I do?