corrected tests

This commit is contained in:
Jochen Stärk
2020-05-24 19:49:05 +02:00
parent b8fa899f60
commit dbdcdbe75f
5 changed files with 50 additions and 34 deletions

View File

@@ -111,35 +111,6 @@ public class XMLValidatorTest extends ResourceCase {
.contains(
"In Deutschland sind die Profile MINIMUM und BASIC WL nur als Buchungshilfe (TypeCode: 751) zugelassen.");
ctx.clear();
try {
tempFile = getResourceAsFile("validv2.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
res = xv.getXMLResult();
content = "<validation>" + res + "</validation>";
assertThat(content).valueByXPath("count(//error)")
.asInt()
.isEqualTo(0);
assertThat(content).valueByXPath("count(//notice)")
.asInt()
.isEqualTo(3); // 3 notices RE XRechnung
assertThat(content).valueByXPath("/validation/summary/@status")
.asString()
.isEqualTo("valid");// expect to be valid because XR notices are, well, only notices
assertThat(content).valueByXPath("/validation/xml/@status")
.asString()
.isEqualTo("valid");
ctx.clear();
tempFile = getResourceAsFile("validV2Basic.xml");

View File

@@ -46,5 +46,38 @@ public class ZUGFeRDValidatorTest extends ResourceCase {
assertEquals(true, res.contains("status=\"valid\""));
assertEquals(false, res.contains("status=\"invalid\""));
tempFile = getResourceAsFile("validAvoir_FR_type380_BASICWL.pdf");
zfv = new ZUGFeRDValidator();
res = zfv.validate(tempFile.getAbsolutePath());
assertEquals(true, res.contains("status=\"valid\""));
assertEquals(false, res.contains("status=\"invalid\""));
}
/***
* the XMLValidatorTests only cover the <xml></xml> part, this one includes the root element and
* the global <summary></summary> part as well
*/
public void testXMLValidation() {
File tempFile = getResourceAsFile("validV2.xml");
ZUGFeRDValidator zfv = new ZUGFeRDValidator();
String res = zfv.validate(tempFile.getAbsolutePath());
assertThat(res).valueByXPath("count(//error)")
.asInt()
.isEqualTo(0);
assertThat(res).valueByXPath("count(//notice)")
.asInt()
.isEqualTo(3); // 3 notices RE XRechnung
assertThat(res).valueByXPath("/validation/summary/@status")
.asString()
.isEqualTo("valid");// expect to be valid because XR notices are, well, only notices
assertThat(res).valueByXPath("/validation/xml/summary/@status")
.asString()
.isEqualTo("valid");
}
}