1
although stubbed methods may return mocks, you cannot inline mock creation (mock()) call inside a thenReturn method (see issue 53)
我下面的https://code.google.com/p/powermock/wiki/MockitoUsage
PowerMockito.mockStatic(MyUtil.class);
Mockito.when(MyUtil.compareVersion("1","2")).thenReturn(200);
此外,我想这个嘲笑类偏,也有其他人在这个类中的方法,这是我不想嘲笑,他们应该照常运行。
详细的异常:
org.mockito.exceptions.misusing.UnfinishedStubbingException:
Unfinished stubbing detected here:
-> at org.powermock.api.mockito.internal.PowerMockitoCore.doAnswer(PowerMockitoCore.java:31)