I have a very simple test case that is using Mockito and Spring Test framework. When I do
when(pcUserService.read(\"1\")).thenReturn(pcUser);
Another solution to this issue might be that in case of a test class that is using PowerMockRunner, you might have to add the class that you are mocking to the list, in @PrepareForTest annotation.
PowerMockRunner
@PrepareForTest
For instance -
@PrepareForTest({ PcUserService.class })