VerifyError on verifyException
falkorichter opened this issue · 3 comments
falkorichter commented
I´m getting this VerifyError when running my test.
The simplified class under test::
public class Action {
public final String payload;
public JSONObject getPayloadJSONObject() throws JSONException {
return new JSONObject(payload);
}
}
The test:
Action action = new Action();
action.payload = "[\"foo\", \"bar\"]";
verifyException(arrayPayloadAction, JSONException.class).getPayloadJSONObject();
my stacktrace:
java.lang.VerifyError: org/mockito/cglib/core/ReflectUtils
at org.mockito.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:167)
at org.mockito.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at org.mockito.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:217)
at org.mockito.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:117)
at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:109)
at org.mockito.cglib.core.KeyFactory.create(KeyFactory.java:105)
at org.mockito.cglib.proxy.Enhancer.<clinit>(Enhancer.java:70)
at org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass(ClassImposterizer.java:96)
at org.mockito.internal.creation.jmock.ClassImposterizer.imposterise(ClassImposterizer.java:60)
at com.googlecode.catchexception.internal.SubclassProxyFactory.createProxy(SubclassProxyFactory.java:59)
at com.googlecode.catchexception.CatchException.processException(CatchException.java:390)
at com.googlecode.catchexception.CatchException.verifyException(CatchException.java:300)
at com.sensorberg.sdk.action.TheActionShould.test_reveal_the_real_type_of_the_payload(TheActionShould.java:22)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
running gradle with these dependencies:
dependencies {
androidTestCompile 'com.squareup:fest-android:1.0.8'
androidTestCompile "org.mockito:mockito-core:1.9.5"
androidTestCompile 'com.google.dexmaker:dexmaker:1.0'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0'
androidTestCompile 'org.apache.commons:commons-io:1.3.2'
androidTestCompile 'eu.codearte.catch-exception:catch-exception:1.3.4'
compile 'com.loopj.android:android-async-http:1.4.5'
}
mariuszs commented
Can you confirm this error on latest release?
mariuszs commented
There are missing dependencies for JSONObject and JSONException in your build.gradle.
mariuszs commented
Ok, It is working with latest catch-exception for me:
Action action = new Action("[\"foo\", \"bar\"]");
verifyException(action, JSONException.class).getPayloadJSONObject();
Action.java
import org.json.JSONException;
import org.json.JSONObject;
public class Action {
public final String payload;
public Action(String payload) {
this.payload = payload;
}
public JSONObject getPayloadJSONObject() throws JSONException {
return new JSONObject(payload);
}
public String getPayload() {
return payload;
}
}