【发布时间】:2021-01-12 16:13:59
【问题描述】:
@Test
fun testBottomSheetShown(){
val args = Bundle().apply {
putString("EXTRA_TITLE", "title")
putString("EXTRA_CURRENT_VALUE", "choiceOne")
}
val scenario = launchFragmentInContainer<ChoicesBottomSheet>(args, R.style.BottomSheetDialog)
scenario.onFragment {
assertEquals(Lifecycle.State.RESUMED, it.lifecycle.currentState)
}
}
我尝试使用片段场景测试我的底部表,但它抛出以下错误:
java.lang.NullPointerException: 该片段已从 FragmentManager 中移除。
【问题讨论】:
标签: android-testing