https://kotlinlang.org logo
#mockk
Title
# mockk
e

eurycea

05/21/2021, 1:37 PM
Is anyone successfully running an Espresso KoinTest that injects a mocked (with mockk) ViewModel via stateViewModel? Is there a trick to getting around getTag needing to return SavedStateHandleController? I am using koin 3.0.1 and mock 1.11.0
java.lang.Object_1_Proxy cannot be cast to androidx.lifecycle.SavedStateHandleController
I assume all of the Koin bits of this are irrelevant but included for context just in case.
j

Jonas

01/31/2023, 11:42 AM
For future reference and anyone else searching - I found the following workaround:
Copy code
every { viewModelMock invoke "getTag" withArguments listOf("androidx.lifecycle.savedstate.vm.tag") } returns null
53 Views