Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
Diff diff = new Diff(..);
assertTrue("XML результат не совпал", diff.similar());
String example = "<....>";
Validator v = new Validator(example);
v.useXMLSchema(true);
v.setJAXP12SchemaSource(new File("xml/example.xsd"));
assertTrue(v.toString(), v.isValid());
@Test public void testSomeXmlGeneration() { // здесь подготавливаются данные для генератора String result = someModule.generateXML(); Diff diff = new Diff(getResourceAsString("/expeced_data.xml"), result); assertTrue("XML результат не совпал", diff.similar()); Tools.showXmlDiff(diff); }
@Before
public void setUp() throws Exception {
XMLUnit.setIgnoreComments(true);
XMLUnit.setIgnoreWhitespace(true);
}
java.lang.NullPointerException
at net.sf.saxon.Controller.prepareInputTree(Controller.java:1386)
at net.sf.saxon.Controller.transform(Controller.java:1318)
at org.custommonkey.xmlunit.Transform.transformTo(Transform.java:211)
at org.custommonkey.xmlunit.Transform.getResultDocument(Transform.java:233)
at org.custommonkey.xmlunit.XMLUnit.stripWhiteSpaceUsingXSLT(XMLUnit.java:515)
at org.custommonkey.xmlunit.XMLUnit.getWhitespaceStrippedDocument(XMLUnit.java:508)
at org.custommonkey.xmlunit.Diff.getWhitespaceManipulatedDocument(Diff.java:182)
at org.custommonkey.xmlunit.Diff.getManipulatedDocument(Diff.java:203)
at org.custommonkey.xmlunit.Diff.<init>(Diff.java:155)
at org.custommonkey.xmlunit.Diff.<init>(Diff.java:145)
at org.custommonkey.xmlunit.Diff.<init>(Diff.java:109)
at org.custommonkey.xmlunit.Diff.<init>(Diff.java:101)
at org.custommonkey.xmlunit.Diff.<init>(Diff.java:93)
at .
@Before
public void setUp() throws Exception {
XMLUnit.setTransformerFactory(
"org.apache.xalan.processor.TransformerFactoryImpl");
XMLUnit.setIgnoreComments(true);
XMLUnit.setIgnoreWhitespace(true);
}
:
Правильная проверка XML данных в java-проектах