I'm trying to set-up unit test cases for my application.
A critical part of the app parses XML files with org.xmlpull.v1.XmlPullParser
. As this part is low-level, isolated and independant from activities, context, views, etc., I really wanted to make it run locally on the JVM, to avoid having to plug or emulate a device all the time.
However when running something like this on the JVM:
XmlPullParser parser = Xml.newPullParser();
parser.setInput(in, null);
...
I get the famous:
Exception in thread "main" java.lang.RuntimeException: Stub!
at android.util.Xml.newPullParser(Xml.java:15)
...
Is there a way around this?
I managed to go around this problem by using Robolectric in Android-Studio. I followed this tutorial, and stumbled upon this other problem.
Now it works fine except I can't see the standard output when running tests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With