PowerMock + Mockito VS Mockito alone

前端 未结 5 892
半阙折子戏
半阙折子戏 2021-01-30 01:15

Can anyone please summarize, what exactly features gives you adding PowerMock on top of the Mockito?

So far I\'ve found these:

  • mock static, final and priva
5条回答
  •  一整个雨季
    2021-01-30 02:03

    For mocking final class we can use org.mockito.plugins.MockMaker. What you would need to do is

    1. Create a folder in your test/resource folder with namemockito-extensions.
    2. Create a file under it with the name org.mockito.plugins.MockMaker.
    3. In that file have just one line mock-maker-inline

    This will not require you to do add any new library and hence save some runtime.

提交回复
热议问题