I'm currently trying to implement a robolectric test.
However, I get the following VerifyError:
java.lang.VerifyError: Expecting a stackmap frame at branch target 50
Exception Details:
Location:
android/app/Application$$UnscopedProvider$$0.<init>(Lorg/androidtransfuse/scope/Scopes;)V @18: ifnull
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: 2ab7 002b 2ab6 002e 1230 0312 02b8 0036
0000010: 4d2c c600 202c 2a2a b600 3904 bd00 0559
0000020: 032b 53b9 003f 0400 57a7 0015 4e2d b800
0000030: 43bf 2a2b b700 28b1 4e2d b800 43bf b1
Exception Handler Table:
bci [21, 41] => handler: 44
bci [50, 55] => handler: 56
at com.unitedinternet.presents.app.PresentsAppApplication.onCreate(PresentsAppApplication.java:41)
at org.robolectric.internal.ParallelUniverse.setUpApplicationState(ParallelUniverse.java:164)
at org.robolectric.RobolectricTestRunner.setUpApplicationState(RobolectricTestRunner.java:430)
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:236)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
My code looks like this (not even using Android Views at the moment):
@Config(emulateSdk = 18, reportSdk = 18, manifest = "./app/AndroidManifest.xml", resourceDir = "./build/intermediates/res/debug")
@RunWith(RobolectricTestRunner.class)
public class ProductServiceTest {
@Inject
@Named(Constants.SERVICE_PRODUCT)
ProductService productService;
@Before
public void setup() {
productService = new MainModule().getProductService();
}
@Test
public void testRetrieveProducts() {
assertThat(productService).isNotNull();
ProductQueryResult queryResult = productService.listProducts(new ProductQuery(new KeywordChangeEvent("schoko"), null, 0, 5));
List<Product> productList = new ArrayList<>();
for (ProductQueryResult.Hit hit : queryResult.getHits().getHits()) {
ProductQueryResult.Source s = hit.getSource();
if (s == null || s.getClass() != ProductQueryResult.Source.class) {
continue;
}
Product p = new Product(s.getTitle(), s.getDeeplink(), s.getPrice(), s.getImage(), s.getSource());
productList.add(p);
}
assertThat(productList).hasSize(5);
}
}
Hi,
I'm currently trying to implement a robolectric test. However, I get the following VerifyError:
My code looks like this (not even using Android Views at the moment):
Is there a way to fix this?