How to android unit test and mock a static method

后端 未结 4 369
隐瞒了意图╮
隐瞒了意图╮ 2020-12-15 22:39

Hi I really hope you can help me, I feel like I\'ve been pulling my hair out for days.

I\'m trying to write unit tests for a method A. Method A calls a static method

4条回答
  •  醉梦人生
    2020-12-15 23:12

    You can use mockito latest version i.e 3.4.+ which allows static mocking

    https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#48

提交回复
热议问题