When running a Junit test on an Android method which uses XMLPullParser throws the following error: “java.lang.UnsatisfiedLinkError: org.xmlpull.v1.XmlPullParserFactory.newInstance()”
The issue is that XMLPullParser is simply an interface and the implementation in the Android .jar is not available in the unit test java project.
1. If you are interested in testing the actual xml parsing logic then include an implementation of the xml pull library in the junit project.
For implementations of XMLPullParser see http://www.xmlpull.org/impls.shtml
2. If you are not interested in testing the actual xml parsing logic simply use a mocking framework to mock it out. To see how to integrate Powermock see my blog post: http://www.stevenmarkford.com/mocking-android-system-objects-using-powermock/