I am currently creating an Android library for use in a reciprocal native project. I need to throw the card in javascript, so I use my own WriteableMap class. Unfortunately, the class loads reactive SO in a static block, which causes an UnsatisfiedLinkError during unit tests. I use JUnit and Mockito for testing.
My code is:
@Override public void onSomething() { WritableMap params = Arguments.createMap();
Error:
java.lang.UnsatisfiedLinkError: no reactnativejni in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1119) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:172) at com.facebook.react.bridge.NativeMap.<clinit>(NativeMap.java:23) at com.facebook.react.bridge.Arguments.createMap(Arguments.java:29) at me.MyClass.onSomething(myClass.java:23)
I started using the Arguments.createMap() method, seeing a comment about doing Stubbing WriteableMap for unit tests, but it is static, and I would prefer not to stop the static method.
Is there a way to get rid of this error when doing unit tests?
source share