運行單元測試時遇到此錯誤。我使用intellij和EasyMock 3.0和cglib(2.2)和Objenesis(1.2)。VerifyError:class net.sf.cglib.core.DebuggingClassWriter重寫最終方法訪問
這裏是我的測試:
public void testGetContentOk() throws Exception {
EasyMock.expect(mockConnectionFactory.getData()).andReturn(mockInputStream);
EasyMock.expect(mockInputStream.read()).andReturn(new Integer((byte)'I'));
EasyMock.expect(mockInputStream.read()).andReturn(-1);
mockInputStream.close();
EasyMock.replay(mockConnectionFactory);
EasyMock.replay(mockInputStream);
WebClient webClient = new WebClient();
String result = webClient.getContent(mockConnectionFactory);
Assert.assertEquals("I", result);
}
有誰知道爲什麼會這樣?
我很好奇這件事,因爲我已經使用正確的版本,至少我認爲是這樣。我會很感激任何幫助。