Powermock mocking void method throws error

后端 未结 1 1368
梦谈多话
梦谈多话 2021-01-27 21:55

I am using Powermockito, mockito with TestNG. My test class extends PowerMockTestCase. I want to mock a void method. For that I used following sample syntax,

@Pr         


        
相关标签:
1条回答
  • 2021-01-27 22:30

    If the void method is not a final method, you do not need to use PowerMockito! Also, I don't see why you would mock "doNoting()". This would be used if you had a default mocking behavior, throwing an exception when the void method is called, and when for a specific test case you would want to override this behavior. Ib your case, would remove this line completely.

    0 讨论(0)
提交回复
热议问题