automatic ox tests

This commit is contained in:
jstaerk
2022-05-16 10:37:51 +02:00
parent a97296c402
commit 219ecb892a
4 changed files with 138 additions and 35 deletions

View File

@@ -199,4 +199,62 @@ public class LibraryTest extends ResourceCase {
.isEqualTo(0);
}
/**
* automatically test the xrechnung
*/
public void testOXValidationSimple() {
File tempFile = new File("../library/target/testout-OX.pdf");
ZUGFeRDValidator zfv = new ZUGFeRDValidator();
String res = zfv.validate(tempFile.getAbsolutePath());
assertThat(res).valueByXPath("count(//error)")
.asInt()
.isEqualTo(0);
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");
/** end of errors due to version mismatch*/
assertThat(res).valueByXPath("count(//notice)")
.asInt()
.isEqualTo(0);
}
/**
* automatically test the xrechnung
*/
public void testOXValidationEdge() {
File tempFile = new File("../library/target/testout-OX-Edge.pdf");
ZUGFeRDValidator zfv = new ZUGFeRDValidator();
String res = zfv.validate(tempFile.getAbsolutePath());
assertThat(res).valueByXPath("count(//error)")
.asInt()
.isEqualTo(0);
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");
/** end of errors due to version mismatch*/
assertThat(res).valueByXPath("count(//notice)")
.asInt()
.isEqualTo(0);
}
}