Android: Unit testing Android applications with Robolectric and Mockito

后端 未结 4 1526
没有蜡笔的小新
没有蜡笔的小新 2021-02-19 22:20

I have a Java library that uses a few things from the Android APIs. I\'d like to use Mockito to write unit tests for this library.

Is there a way I can go about this? <

4条回答
  •  伪装坚强ぢ
    2021-02-19 23:00

    As of version 1.9.5 (released 3rd of June, 2012) you can use Mockito with Android. To do this you will also require dexmaker:

    http://code.google.com/p/dexmaker/

    This wiki page describes how to implement it:

    http://code.google.com/p/dexmaker/wiki/Mockito

提交回复
热议问题