Mock objects calling final classes static methods with Mockito

前端 未结 2 1605
名媛妹妹
名媛妹妹 2020-12-10 22:58

I just started mocking different layers of our application. I came to a point where one of my mock objects is returning NPE when it calls a final class static method. Is th

2条回答
  •  不知归路
    2020-12-10 23:43

    Mockito doesn't support mocking a final class.Have a look at PowerMock.It allows you to mock static methods and classes. It can work with Mockito, documentation explains how to do that.

提交回复
热议问题