Title
a

adi

08/30/2017, 10:57 PM
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

gildor

08/31/2017, 1:03 AM
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

budioktaviyan

08/31/2017, 3:10 AM
or just apply the kotlin "open-all" plugin ?
g

gildor

08/31/2017, 3:11 AM
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

budioktaviyan

08/31/2017, 3:12 AM
what is pros and cons if I do that ?
g

gildor

08/31/2017, 3:14 AM
Those classes can be extended by any client of your library for example or inside your code using reflections