2012-10-17 60 views
1

嘗試使用Mockito.spy對Android VM(仿真器4.1)進行測試後,對其進行部分模擬。以下是錯誤我得到Android上的dexmaker Mockito - 獲取虛擬機錯誤嘲笑活動

java.lang.VirtualMachineError 
at dalvik.system.DexFile.defineClass(Native Method) 
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:207) 
at dalvik.system.DexFile.loadClass(DexFile.java:196) 
at dalvik.system.DexClassLoader.findClass(DexClassLoader.java:226) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:551) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 
at com.google.dexmaker.stock.ProxyBuilder.loadClass(ProxyBuilder.java:272) 
at com.google.dexmaker.stock.ProxyBuilder.buildProxyClass(ProxyBuilder.java:254) 
at com.google.dexmaker.mockito.DexmakerMockMaker.createMock(DexmakerMockMaker.java:54) 
at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:26) 
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:49) 
at org.mockito.Mockito.spy(Mockito.java:1324) 
at com.company.droid.helper.ActivitySandbox.setupActivity(ActivitySandbox.java:21) 
at com.company.droid.ui.fragment.signup.SignupFragmentTest.setUp(SignupFragmentTest.java:50) 
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) 
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) 
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:529) 
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448) 

我試圖改變虛擬機,版本的Mockito,Dexmaker版本,但似乎沒有任何工作。有任何想法嗎?

+1

你可以看看你的日誌中是否有來自Dalvik的消息,尤其是在安裝或應用程序啓動時?你通常會得到一堆表明(或許隱含地)關於這個問題的更多細節。 – danfuzz

+0

我最近從儀器測試切換到junit與robolectric庫配對。關於間諜 - 我的觀察通常是設計問題。 –

+1

跟蹤此處:https://code.google.com/p/dexmaker/issues/detail?id=9 –

回答