我目前正在为Android应用程序编写单元测试,并偶然发现了以下问题:
我用它ServiceTestCase来测试IntentService这样的:
@Override
public void setUp() throws Exception {
super.setUp();
}
public void testService()
{
Intent intent = new Intent(getSystemContext(), MyIntentService.class);
super.startService(intent);
assertNotNull(getService());
}
Run Code Online (Sandbox Code Playgroud)
但是我注意到我IntentService的创建(意味着onCreate被调用),但我从未接到过调用onHandleIntent(Intent intent)
有人已经IntentService在ServiceTestCase课堂上测试了吗?
谢谢!