Android does not recognize Mockito NoClassDefFoundError

0

I'm trying to use Mockito to run tests on an Android app. I copied the following jars for the project: Mockito-all-1.9.5.jar, dexmaker-1.0.jar, dexmaker-Mockito-1.0.jar. Then I added it to BuildPath. It does not generate compile error, but when I run the tests, the following error appears:

    java.lang.NoClassDefFoundError: org.mockito.Mockito
at com.example.projetomockito.test.ClienteTest.testExisteCliente(ClienteTest.java:17)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:545)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)

The error appears in the following line:

cliente = mock(Cliente.class);
    
asked by anonymous 16.08.2015 / 23:30

0 answers