我写过convertStringToDocument方法,我不明白怎么写 这种方法的junit测试用例。请帮忙...
public static String convertStringToDocument(String xmlString) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder;
try {
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl",true);
builder = factory.newDocumentBuilder();
Document doc = (Document) builder.parse(new InputSource(new StringReader( xmlString )));
// return doc;
} catch (ParserConfigurationException| SAXException| IOException e) {
System.out.println("Unable to convert string to Document");
}
return null;
}