I have a fragment which waits for an integer from args. The code itself works fine, but when I want to write a UI test for this fragment it gives me a
java.lang.NullPointerException: null cannot be cast to non-null type kotlin.Int at androidx.navigation.NavType$Companion$IntType$1.get(NavType.kt:320) at androidx.navigation.NavType$Companion$IntType$1.get(NavType.kt:310) at androidx.navigation.NavArgument.verify(NavArgument.kt:76) at androidx.navigation.NavDestination.addInDefaultArgs(NavDestination.kt:603) at androidx.navigation.NavController.navigate(NavController.kt:1855) at androidx.navigation.NavController.handleDeepLink(NavController.kt:1414) at androidx.navigation.testing.TestNavHostController.setCurrentDestination(TestNavHostController.kt:51) at androidx.navigation.testing.TestNavHostController.setCurrentDestination$default(TestNavHostController.kt:47) at com.wolfpackdigital.extrakarte.base.BaseUITest.setupNavigation(BaseUITest.kt:130)`
The line which this refers to is
`navController.setCurrentDestination(R.id.MyFragment)
I initialize my scenario like this:
val bundle = bundleOf(
"myParam" to 3
)
scenario = launchFragmentInContainer(themeResId = R.style.AppTheme, fragmentArgs = bundle)
With every other type of parameter it works (String, custom data model), but with integer it just doesn't cooperate with me.
Any ideas?