Yves Kalume
09/19/2024, 11:31 PMRoute
object in SavedStateHandle
?
For example, I have the following code:
private val route = savedStateHandle.toRoute<MyRoute>()
How can I instantiate the SavedStateHandle
object in my tests? Specifically, what should I provide as a key for the map? I’ve tried code similar to the following, but none of the Route
properties are being passed :
val savedStateHandle = SavedStateHandle(mapOf(MyRoute::class.qualifiedName to fakeRoute))
Ian Lake
09/19/2024, 11:35 PMnavigation-testing
library has a SavedStateHandle(MyRoute())
factory method: https://developer.android.com/reference/kotlin/androidx/navigation/testing/package-summary?hl=en#(androidx.lifecycle.Save[…],kotlin.collections.Map)Ian Lake
09/19/2024, 11:36 PMMarko Novaković
11/22/2024, 2:40 PMMarko Novaković
11/22/2024, 2:41 PMandroid.os.Bundle
methods not mocked error.
I have testOptions.unitTests.isReturnDefaultValues = true
in gradleIan Lake
11/22/2024, 3:20 PMJonas
03/20/2025, 10:20 AMIan Lake
03/20/2025, 2:21 PMjvmTest
(no Robolectric) with SavedStateHandle
Jonas
03/20/2025, 2:23 PMMarko Novaković
03/20/2025, 2:50 PM