ARNdroid / EasyTargetDiet

Android Easy Target Diet project.
4 stars 1 forks source link

Mockito: some tests fail on N5 #218

Open ARNdroid opened 9 years ago

ARNdroid commented 9 years ago

Nine test are failing at br.com.arndroid.etdiet.test.backup.custom.CustomBackupManagerTest with the same main cause:

java.lang.IllegalArgumentException: dexcache == null (and no default could be found; consider setting the 'dexmaker.dexcache' system property)
at com.google.dexmaker.DexMaker.generateAndLoad(DexMaker.java:359)
at com.google.dexmaker.stock.ProxyBuilder.buildProxyClass(ProxyBuilder.java:252)
at com.google.dexmaker.mockito.DexmakerMockMaker.createMock(DexmakerMockMaker.java:56)
at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:33)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:59)
at org.mockito.Mockito.mock(Mockito.java:1285)
at org.mockito.Mockito.mock(Mockito.java:1163)
at br.com.arndroid.etdiet.test.backup.custom.CustomBackupManagerTest.[some_test_method]

We have NO problems running the same tests on SII device.

ARNdroid commented 9 years ago

This question at stackoverflow states that the problem is related to dexmaker and the incoming version 1.3 seems to solve it.

I have also starred the original issue at dexmaker project.

ARNdroid commented 9 years ago

The final state of our test case is undesirable: the class and the context was changed (except for the workaround, there is no reason to be an InstrumentationTestCase or use a targetContext).

Moreover, we will need to construct a lot of test using mock classes for third part API and creating they this way will require a lot of rework after the real bug was solved in dexmaker.

We'll reopen this issue and point CustomBackupManagerTest to its original state.

The unit test will run most of time on SII device, without side effects.

This issue will wait for the 1.3 version of dependencies (that seems to solve the real issue).