I am trying to unit test in Android a class that uses XmlSerializer
but for some reason, Xml.newSerializer
always returns null. The app code that uses xmlSerializer
runs fine though. Does anyone know why it only returns null when unit testing?
import org.junit.Test;
import org.xmlpull.v1.XmlSerializer;
public class TestClass
{
@Test
public void test()
{
XmlSerializer serializer = Xml.newSerializer();
if (serializer == null) {
System.out.println("Is Null!");
}
}
}
The test frameworks I am using are Espresso and Mockito. Thanks.