的VerifyError使用的Mockito 1.9.5和DexMaker-的Mockito-1.0 [英] VerifyError using Mockito 1.9.5 and DexMaker-Mockito-1.0

查看:349
本文介绍了的VerifyError使用的Mockito 1.9.5和DexMaker-的Mockito-1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很多人一样我很高兴地听到,的Mockito现在的作品与Android 并遵循< A HREF =htt​​p://www.paulbutcher.com/2012/05/mockito-on-android-step-by-step>本教程看到它自己的眼睛。一切似乎扇扑tastic和我出发纳入嘲讽溶液进入我的Andr​​oid测试项目...

Like many others I was excited to hear that Mockito now works with Android and followed this tutorial to see it with my own eyes. Everything seemed fan-flapping-tastic and I got underway incorporating the mocking solution into my Android Test Project...

然而,在建立我的应用程序的测试项目,充分利用的Mockito-ALL-1.9.5 dexmaker-1.0 dexmaker-的Mockito-1.0 罐子我遇到了一个问题,我的第一个测试用例。 precisely 这个问题的其实。我想援助的一部分;

However, on setting up my application's test project to leverage the mockito-all-1.9.5, dexmaker-1.0 and dexmaker-mockito-1.0 jars I encountered a problem with my very first test case. Precisely this problem in fact. The part that I would like assistance on is;

Caused by: 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)

我被告知,这根本不是那么回事,但由于堆栈跟踪意味着DexMaker罐子没有被使用 - 引用的这种反应。然而,我怀疑,我做错了什么关于我的项目设置,所以我正在寻找从这里集体知识基础,借鉴,看看这确实是用户错误或β-错误。

I have been informed that this "simply doesn't quite work yet" since the stack trace implies that the DexMaker jar is not being used - reference this response. However, I am suspicious that I am doing something wrong with respect to my project set-up so I'm looking to draw from the collective knowledge base here to see if indeed this is user error or a beta-bug.

请在下面找到了我的测试项目的配置的屏幕截图。该项目是通过Android向导和股票没有什么特别的功能比在库列入的Mockito和DexMaker罐子(上述)等创建目录。

Please find below a screenshot of my test project's configuration. The project was created via the Android Wizard and shares no special features other than the inclusion of the Mockito and DexMaker jars (mentioned above) under the libs directory.

没关系测试的内容(执行单元测试前的测试失败)的设置是,如下所述;

Never mind the content of the test (the test fails before the unit test is executed) the set-up is as described below;

public class TestSpotRatingCalculator extends InstrumentationTestCase {
  @Mock
  private AService aService; // Changed the service names being used here - not important.
  @Mock
  private BService bService;
  @Mock
  private CService cService;
  @Mock
  private DService dService;

  /**
   * @see android.test.AndroidTestCase#setUp()
   */
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    MockitoAnnotations.initMocks(this);  // Failure here with aforementioned stacktrace...
  }

如果有人在那里有一个想法,什么是错的,那么请声,在这里下车。

If anyone out there has an idea what is wrong then please sound-off here.

推荐答案

由于暗示的这里 dexmaker-机器人组合的只适用于100%时,仪器测试针对的真正的设备上运行。

As hinted at here the dexmaker-android combo only works 100% when the instrumented tests are run against a real device.

针对实际设备运行测试不会出现此故障。

Running the tests against a real device do not exhibit this failure.

这篇关于的VerifyError使用的Mockito 1.9.5和DexMaker-的Mockito-1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆