获取异常:
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)