Mock final class with Mockito 2

前端 未结 7 983
醉酒成梦
醉酒成梦 2020-12-01 12:31

I\'m removing Powermock from the project I\'m currently working on, so I\'m trying to rewrite some existing unitary test only with Mockito (mockito-core-2.2.28).

When

7条回答
  •  天命终不由人
    2020-12-01 12:43

    You seem to have had a classpath issue, just like I did.

    Your previous setup would have also worked, but it seems like

    project/test/resources
    

    was not in your classpath.

    I had the same issue when I tried to run this with IntelliJ. I simply marked the resources directory as a Test Resources Root and it worked fine. Praise the gods of Mockito!

提交回复
热议问题