How to mock final class with Mockito 2 on Java Module in Android project?

前端 未结 2 1590
生来不讨喜
生来不讨喜 2020-12-10 20:30

I have a Android Clean Architecture project write in Kotlin with 3 modules:

  • data (Android Library)
  • domaine (Java Library)
  • presentation (Andro
2条回答
  •  误落风尘
    2020-12-10 21:21

    Mockito's MockMaker can only be used for unit tests (run on JVM). For those who are having problems with mocking Kotlin classes in instrumentation tests (androidTest), try using the DexOpener library. It makes Kotlin classes, properties and methods open, which allows their mocking.

提交回复
热议问题