You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer the following questions for yourself before submitting an issue.
I am running the latest version
I checked the documentation and found no answer
I checked to make sure that this issue has not already been filed
Expected Behavior
The test should pass.
Current Behavior
Obtain mutableLiveData value throws a java.lang.ClassCastException: java.lang.Object cannot be cast to java.lang.String
Context
If you try to InjectMockKs with MutableLiveData dependency is impossible to obtain the mock value in your ClassTest. This behaviour is used especially when you use DataSource.Factory you can check the class here. Moreover the same sample with Mockito works correctly.
MockK version: 1.9.3
OS: OS X
Kotlin version: 1.3.50
JDK version: 11
JUnit version: 4.12
Type of test: unit test
Stack trace
java.lang.ClassCastException: java.lang.Object cannot be cast to java.lang.String
at com.vmadalin.dynamicfeatures.characterslist.ui.list.paging.SampleTest$ClassTest.doSomething(FunTest.kt:35)
at com.vmadalin.dynamicfeatures.characterslist.ui.list.paging.SampleTest.test(FunTest.kt:28)
Minimal reproducible code (the gist of this issue)
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Expected Behavior
The test should pass.
Current Behavior
Obtain mutableLiveData value throws a
java.lang.ClassCastException: java.lang.Object cannot be cast to java.lang.String
Context
If you try to InjectMockKs with
MutableLiveData
dependency is impossible to obtain the mock value in yourClassTest
. This behaviour is used especially when you useDataSource.Factory
you can check the class here. Moreover the same sample withMockito
works correctly.Stack trace
Minimal reproducible code (the gist of this issue)
The text was updated successfully, but these errors were encountered: