powered by Jive Software

Unit test an IQProvider implmentation

Greetings,

I’‘m writing an IQProvider implementation, and I like to write code test-first. I want to test whether my IQProvider can correctly parse a very small chunk of XML, but I can’‘t figure out how to feed the XML to the method, as the method takes only an instance of org.xmlpull.v1.XmlPullParser. I can’‘t believe that I’‘ve eaten so many Peanut M&M’‘s that I’'m stumbling this much!!! Please advise.

Thanks,

Craig

Craig,

The easiest way to test would be to just send that XML to your client and then let the provider parse it. Another option would be to initialize an XMLPullParser instance on the XML you want to try parsing. The XMLPullParser API is quite simple to use.

Regards,

Matt