Mockito Exception - when() requires an argument which has to be a method call on a mock

后端 未结 9 2318
终归单人心
终归单人心 2020-12-15 15:12

I have a very simple test case that is using Mockito and Spring Test framework. When I do

when(pcUserService.read(\"1\")).thenReturn(pcUser);
9条回答
  •  失恋的感觉
    2020-12-15 16:03

    I had the same issue, the method that I was trying to mock it was a final method. I removed the modifier and it worked fine.

提交回复
热议问题