One of my colleagues told me Mockk. The library is pure Kotlin mocking library. An interesting thing for me is Android instrumentation support.
I had a question when I saw that why Android P was a limitation. Since it provide mocking feature for final classes / objects in instrumentation tests.
I investigated a bit and I found interesting issues. So I left them here for my note.
Mokito
- mockito-android cannot copy hidden fields and call hidden methods of Android P system classeshttps://github.com/mockito/mockito/issues/1395
Dexmaker
- https://github.com/linkedin/dexmaker/issues/97
- https://github.com/linkedin/dexmaker/issues/103
- Why the mockings work on Android P+
BTW, Dexmaker has been provided mocking final classes/methods with Mokito on Android P. We can use the feature with below.
- Add
androidTestImplementation dexmaker-mockito-inline
instead ofdexmaker-mockito
Thanks for the fixing and improvements.
2 Comments