如何在不使用已棄用的ServiceTestCase
的情況下在Android中測試IntentService
?如何測試IntentService android?
從ServiceTestCase的文檔:
這個類是在API級別24 使用ServiceTestRule代替過時。應使用Android測試支持庫編寫新的測試。
但ServiceTestRule文件說,它不支持IntentService
S:
注:此規則不支持IntentService因爲它自動銷燬時onHandleIntent(android.content.Intent)完成所有懸而未決命令。 因此,無法及時建立成功的連接。
我該如何測試IntentService
呢?