Java Unit test for Exception
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try
{
builder = factory.newDocumentBuilder();
}
catch (ParserConfigurationException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
try
{
doc = builder.parse(entity.getContent());
}
catch (IllegalStateException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (SAXException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
There are 3 exceptions I need to write Junit test to get into the
exception. Does anyone know how to use powermock or easymock class to
write the unit test for it?
No comments:
Post a Comment