java - Cant mock objects on my android project -
I can not duplicate any object on my test cases. That's why I should do something wrong. I can run matters without my trial, and it works fine but as soon as I try to duplicate an object, I get the following error when I try to run the trial case. Java.lang.ExceptionInInitializerError
I Dependency {compile fileTree (dir: 'libs', includes:' * .jar ') Project (compilation': Google play-services_lib ') Project (compilation': Facebook-sdk_lib ') compilation' de .greenrobot: greendao: 1.3.7 'compilation' org.mockito: mockito-core: 1.9.5 "} Android { out of 'META-INF / ASL2.0' to 'meta-INF / license' outside 'meta INF / notice'} compileSdkVersion 19 buildToolsVersion "19.1.0" lintOptions {abortOnError False} {} SourceSets Main {manifest.srcFile 'AndroidManifest.xml' Java {srcDir 'src' srcDir 'src generation' srcDir 'test'} {Resources srcDir 'Src' srcdir 'src-gen'} aidl.srcDirs = ['src', ' Src-gen '] renderscript.srcDirs = [' src ',' src-gen '] res.srcDirs = [' res'] assets.srcDirs = ['property']} androidTest.setRoot ('test') debug.setRoot ('Build-type / debug') release.setRoot ('build-type / release')}} I do not know that with a big problem Is obtained. Here is also one of my test classes And finally it can help in understanding how my class hierarchy looks. If that even helps, then Any help that will take me to the right path to fix this issue is welcome. Thank you very much
org.mockito.internal.creation.jmock.ClassImposterizer.createProxyClass (ClassImposterizer.java:85) > Android Studio and this is how my Gradual file appears
Apply the plugin: 'android'
Public category ValueFormatTest Extended AndroidTestCase {Public ValueFormatTest () {/ * Nothing! * /} / * (Non-javaadok) * @see junit.framework.TestCase # setUp () * / Protected Zero Setup () throws exception {super.setUp (); } / * (Non-javaadok) * @see junit.framework.TestCase #tearDown () * / Protected Wired Tyride () throws exception {super.tarDown (); } Public Final Zero testFormaterDateTime () {Mockito.mock (BaseConnection.class); Assert.assertEquals ("", ValueFormat.formatDateTime (getContext (), 2, faucet)); Assert.assertEquals ("", ValueFormat.formatDateTime (getContext (), 1, faucet)); Assert.assertEquals ("", ValueFormat.formatDateTime (getContext (), -1, faucet)); }}
create ProjectFolder-.idea -DaoGenerator -Facebook -Google-Play-Services -ModuleCar | -libs | Create | -src | -src generation -tests | -Lib | -Ray | -src.com.car.test
I found a solution to my problem in the gradle.build
file . I have changed how I imported Mokoto, the problem was that it could not get a Dexmaker.
compile ("org.mockito: mockito-core: 1.9.5") {Exclude Group: 'org.hamcrest'} 'compile com' .google.dexmaker: dexmaker: 1.1 'Compilation' com.google.dexmaker: dexmaker-mockito: 1.1 ''
Comments
Post a Comment