1) Am I testing wrong if I am trying to mock data ...
# android
a
1) Am I testing wrong if I am trying to mock data classes in kotlin? 2) If the answer for first question is no, I am having issues mocking it with Mockito 2 even after following this article by Haidi hariri. http://hadihariri.com/2016/10/04/Mocking-Kotlin-With-Mockito/ Do I have to do something on top of it?
g
2. Just as remark about your problem. You can mock final classes using Mockito in unit test, it’s impossible for Android Instrumentation tests.
b
or just apply the kotlin "open-all" plugin ?
g
This is also solution, but you should understand that now is no way to apply open-all only for tests, so all your classes annotated with open-all annotation will be opened.
b
what is pros and cons if I do that ?
g
Those classes can be extended by any client of your library for example or inside your code using reflections