如何在不使用已弃用的ServiceTestCase
的情况下在Android中测试IntentService
?如何测试IntentService android?
从ServiceTestCase的文档:
这个类是在API级别24 使用ServiceTestRule代替过时。应使用Android测试支持库编写新的测试。
但ServiceTestRule文件说,它不支持IntentService
S:
注:此规则不支持IntentService因为它自动销毁时onHandleIntent(android.content.Intent)完成所有悬而未决命令。 因此,无法及时建立成功的连接。
我该如何测试IntentService
呢?