Spy object by Mockito in Spring

后端 未结 4 552
眼角桃花
眼角桃花 2020-12-20 17:56

When I try to Spy an object in my unit test, I got an exception. This is my unit test file:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loc         


        
4条回答
  •  难免孤独
    2020-12-20 18:38

    It might be problem with the dependencies. The powermock-api-mockito has compile time dependency on mockito-core version 1.10.19, but you have also defined a dependency on version 2.0.44-beta. This might be a classpath problem. Try removing the explicit dependency on version 2.0.44-beta.

提交回复
热议问题