android-stackblur icon indicating copy to clipboard operation
android-stackblur copied to clipboard

Robolectric test

Open jxpx91 opened this issue 8 years ago • 0 comments

I had a problem when I use Robolectric tests. Two of my test use this library but sometimes one of them works and sometimes any works.

Gradle: compile 'com.commit451:NativeStackBlur:1.0.2'

Here is my code:

imageLoader.displayImage(urlImage, imageTitulo, options, new ImageLoadingListener() {
            @Override
            public void onLoadingStarted(String s, View view) {}
            @Override
            public void onLoadingFailed(String s, View view, FailReason failReason) {}
            @Override
            public void onLoadingComplete(String s, View view, Bitmap bitmap) {
                Bitmap bm = NativeStackBlur.process(bitmap, 10);
                imageTitulo.setImageBitmap(bm);
                imageStreetV.setImageBitmap(bitmap);
            }
            @Override
            public void onLoadingCancelled(String s, View view) {}
        });

And here is the output:

java.lang.NoClassDefFoundError: Could not initialize class com.enrique.stackblur.NativeBlurProcess

	at com.commit451.nativestackblur.NativeStackBlur.process(NativeStackBlur.java:20)
	at mx.org.inegi.denuemv.ficha.FichaFragment$6.onLoadingComplete(FichaFragment.java:303)
	at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:253)
	at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:365)
	at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:340)
	at mx.org.inegi.denuemv.ficha.FichaFragment.setData(FichaFragment.java:296)
	at mx.org.inegi.denuemv.MapsActivityTest.openFicha(MapsActivityTest.java:153)
	at mx.org.inegi.denuemv.MapsActivityTest.openStreetViewTest(MapsActivityTest.java:123)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:523)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.robolectric.internal.SandboxTestRunner$2.evaluate(SandboxTestRunner.java:226)
	at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:108)
	at org.robolectric.internal.SandboxTestRunner.runChild(SandboxTestRunner.java:35)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.robolectric.internal.SandboxTestRunner$1.evaluate(SandboxTestRunner.java:62)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)

The App works as well but the tests failed, I don't know why they failed just sometimes.

Thanks!

jxpx91 avatar Nov 13 '17 18:11 jxpx91