Mockito when().thenReturn calls the method unnecessarily

后端 未结 5 2345
挽巷
挽巷 2021-02-19 02:23

I\'m working a bit on an inherited code. I\'ve written a test that is supposed to catch NullPointerException (for it is trying to call a method from null object)



        
5条回答
  •  梦毁少年i
    2021-02-19 02:42

    I ran across this thread while trying to fix the same issue in my tests.

    In case others see this issue and end up here...In my case it was caused by not using the @PrepareForTest annotation for the support class.

提交回复
热议问题