I am going to create a XML from a string. It looks like
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
public Document createCompleteExportXml(String xmlFilename, String content) {
    try {
        DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder();
        //create the XML file here
    } catch (ParserConfigurationException pce) {
        LOGGER.trace("parsing error ", pce);
    }
}
Now I must test if the exception can be caught in a Junit test.
@Test(expected=ParserConfigurationException.class)
public void createCompleteExportXmlWithParseConfigurationException() {
    String xmlFilename = "junitExportTestWithParseConfigurationException.xml";
    String content = "any content";
    XmlFileWriter writer = new XmlFileWriter();
    Document doc = writer.createCompleteExportXml(xmlFilename, content);
}
How can I make this test throw the ParserConfigurationException? 
I make my question more concrete: How can I make documentFactory.newDocumentBuilder() not able to work, because "a DocumentBuilder cannot be created which satisfies the configuration requested."? Where is the configuration? How can I change it intentionally to a wrong one?
 
     
     
    