我想在 android 中监视 Linkedlist。
List list = new LinkedList();
List spyData = Mockito.spy(list);
spyData.add("xxxx");
然而,异常发生了。
java.lang.AbstractMethodError: abstract method "boolean org.mockito.internal.invocation.AbstractAwareMethod.isAbstract()"
at org.mockito.internal.invocation.InvocationImpl.callRealMethod(InvocationImpl.java:109)
at org.mockito.internal.stubbing.answers.CallsRealMethods.answer(CallsRealMethods.java:41)
at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:93)
at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29)
at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:38)
at com.google.dexmaker.mockito.InvocationHandlerAdapter.invoke(InvocationHandlerAdapter.java:49)
at LinkedList_Proxy.add(LinkedList_Proxy.generated)
at com.app.test.testmethod(mytest.java:202)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1858)
库的依赖项是
dexmaker-1.2.jar
dexmaker-mockito-1.2.jar
mockito-core-1.10.19.jar
即使我更新mockito-core-1.10.19.jar
到mockito-core-2.0.31-beta.jar
,
问题依然存在。
但是Mockito.mock(Linkedlist.class)
没关系,我对这个问题没有任何想法。
谢谢你。