I'm running into this strange VerifyError when trying to run Robolectric tests that call ShinobiControls under the hood. I've tried the -noverify option, but it doesn't seem to be working, or I'm putting it in the wrong place.
I'm using Retrolambda, Java 8, Robolectric (3.0), and Shinobi Premium (1.8.0).
java.lang.VerifyError: Expecting a stackmap frame at branch target 18
Exception Details:
Location:
com/shinobicontrols/charts/ChartFragment.onResume()V @8: ifnull
Reason:
Expected stackmap frame at this location.
Bytecode:
0x0000000: 2ab7 000b 2ab4 0006 c600 0a2a b400 06b6
0x0000010: 0012 b1
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at android.app.Fragment.instantiate(Fragment.java:611)
at android.app.Fragment.instantiate(Fragment.java:582)
at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2108)
at android.app.Activity.onCreateView(Activity.java:5282)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at android.app.Activity.setContentView(Activity.java:2144)
at com.example.android.MainActivity.onCreate(MainActivity.java:132)
Basically, we are facking shinobi view. We have next construction:
And in test we fake it:
If you want to verify that you also correctly setup shinobi charts then you need to mock
ShinobiChart
and return notView
but fakedShinobiView