Issue with abstract method after updating from Mockito 1.9.5 to 2.8.9
See original GitHub issueI am having an issue when trying to spy an object after moving from Mockito 1.9.5 to 2.8.9
when I use gradlew to look at all my dependencies, i do not see any old versions of Mockito hanging around as you mentioned in a previous post with a nearly identical call stack. Cleaned, resync’d Android Studio, etc.
Do I need to implement the missing abstract method? If no, then what else could be the issue here? I always assume that I’m doing something wrong.
From my build.gradle
compile ('org.mockito:mockito-core:2.8.9') {
exclude module: 'objenesis'
exclude group: 'org.objenesis', module: 'objenesis'
}
compile 'com.google.dexmaker:dexmaker-mockito:1.2'`
Snip of code where this is happening. (works ok in 1.9.5, but not 2.x.x)
ConnectivityManager origCm = (ConnectivityManager)super.getSystemService(name);
ConnectivityManager connectivityManager = Mockito.spy(origCm);
java.lang.AbstractMethodError: abstract method “org.mockito.plugins.MockMaker$TypeMockability org.mockito.plugins.MockMaker.isTypeMockable(java.lang.Class)” at org.mockito.internal.util.MockUtil.typeMockabilityOf(MockUtil.java:29) at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22) at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:186) at org.mockito.internal.creation.MockSettingsImpl.confirm(MockSettingsImpl.java:180) at org.mockito.internal.MockitoCore.mock(MockitoCore.java:62) at org.mockito.Mockito.spy(Mockito.java:1812) at example.com.myclient.MyMainApp.getSystemService(MyMainApp.java:114) at com.scrubbed.android.sdk.net.VocAccelerator.init(VocAccelerator.java:96) at com.scrubbed.android.sdk.VocService.createVocService(VocService.java:143) at com.scrubbed.vocsdkliveapitestlib.SdkLiveTest_BaseServiceTest.setSomeService(SdkLiveTest_BaseServiceTest.java:217) at com.scrubbed.vocsdkliveapitestlib.SdkLiveTest_BaseServiceTest.unRegisterIfNecessary(SdkLiveTest_BaseServiceTest.java:166) at com.scrubbed.vocsdkliveapitestlib.SdkLiveTest_BaseServiceTest.waitForSyncToFinishAndThenDeregister(SdkLiveTest_BaseServiceTest.java:211) at com.scrubbed.vocsdkliveapitestlib.SdkLiveTest_BaseServiceTest.unRegisterIfNecessary(SdkLiveTest_BaseServiceTest.java:151) at com.scrubbed.vocsdkliveapitestlib.SdkLiveTest_BaseServiceTest.setUp(SdkLiveTest_BaseServiceTest.java:41) at com.scrubbed.android.sdk.internal.MapLT_AICTests.setUp(MapLT_AICTests.java:77) at junit.framework.TestCase.runBare(TestCase.java:132) at junit.framework.TestResult$1.protect(TestResult.java:115) at android.support.test.internal.runner.junit3.AndroidTestResult.runProtected(AndroidTestResult.java:77) at junit.framework.TestResult.run(TestResult.java:118) at android.support.test.internal.runner.junit3.AndroidTestResult.run(AndroidTestResult.java:55) at junit.framework.TestCase.run(TestCase.java:124) at android.support.test.internal.runner.junit3.NonLeakyTestSuite$NonLeakyTest.run(NonLeakyTestSuite.java:63) at junit.framework.TestSuite.runTest(TestSuite.java:243) at junit.framework.TestSuite.run(TestSuite.java:238) at android.support.test.internal.runner.junit3.DelegatingTestSuite.run(DelegatingTestSuite.java:103) at android.support.test.internal.runner.junit3.AndroidTestSuite.run(AndroidTestSuite.java:69) at android.support.test.internal.runner.junit3.JUnit38ClassRunner.run(JUnit38ClassRunner.java:103) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59) at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1873) `
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
Problem solved. Cleaned again, this time deleted .gradle folder in the root of the project and resync’d rebuilt. Root of the problem was that at one time we were trying out PowerMock. Gradle don’t quite make the “Grade”.
Closing.
If anyone is hitting these same problems, it’s definitely due to incorrect versions of Mockito being references from elsewhere.
Still an issue with PowerMockMaker. Strange. Seems like I still have more cleaning to do, but not sure how…