added a test to expect a failing ZF1 validation
This commit is contained in:
@@ -71,6 +71,28 @@ public class ZUGFeRDValidatorTest extends ResourceCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* the XMLValidatorTests only cover the <xml></xml> part, this one includes the root element and
|
||||||
|
* the global <summary></summary> part as well
|
||||||
|
*/
|
||||||
|
public void testV1XMLValidation() {
|
||||||
|
File tempFile = getResourceAsFile("invalidV1addition.xml");
|
||||||
|
ZUGFeRDValidator zfv = new ZUGFeRDValidator();
|
||||||
|
|
||||||
|
String res = zfv.validate(tempFile.getAbsolutePath());
|
||||||
|
|
||||||
|
assertThat(res).valueByXPath("count(//error)")
|
||||||
|
.asInt()
|
||||||
|
.isNotEqualTo(0);
|
||||||
|
|
||||||
|
assertThat(res).valueByXPath("/validation/summary/@status")
|
||||||
|
.asString()
|
||||||
|
.isEqualTo("invalid");// expect to be valid because XR notices are, well, only notices
|
||||||
|
assertThat(res).valueByXPath("/validation/xml/summary/@status")
|
||||||
|
.asString()
|
||||||
|
.isEqualTo("invalid");
|
||||||
|
|
||||||
|
}
|
||||||
/***
|
/***
|
||||||
* the XMLValidatorTests only cover the <xml></xml> part, this one includes the root element and
|
* the XMLValidatorTests only cover the <xml></xml> part, this one includes the root element and
|
||||||
* the global <summary></summary> part as well
|
* the global <summary></summary> part as well
|
||||||
|
|||||||
@@ -1,4 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<!--
|
||||||
|
The reason why this file fails the ZUGFeRD v1 schematron check is it's empty
|
||||||
|
rsm:SpecifiedSupplyChainTradeTransaction/ram:ApplicableSupplyChainTradeAgreement/AdditionalReferencedDocument element.
|
||||||
|
|
||||||
|
Please note that the following additional errors in this file go unnoticed:
|
||||||
|
- ApplicableTradeTax/BasisAmount being 161 instead of 160
|
||||||
|
- SpecifiedTradeSettlementMonetarySummation/LineTotalAmount being 1496 instead of 496
|
||||||
|
- SpecifiedTradeSettlementMonetarySummation/GrandTotalAmount and /DuePayableAmount being 1571.4 instead of 571.04 (wrong amount and wrong number of decimals)
|
||||||
|
- IncludedSupplyChainTradeLineItem for line ID 3 SpecifiedSupplyChainTradeSettlement/SpecifiedTradeSettlementMonetarySummation/LineTotalAmount being 201 instead of 20
|
||||||
|
|
||||||
|
|
||||||
|
-->
|
||||||
<rsm:CrossIndustryDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15" xmlns:rsm="urn:ferd:CrossIndustryDocument:invoice:1p0">
|
<rsm:CrossIndustryDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15" xmlns:rsm="urn:ferd:CrossIndustryDocument:invoice:1p0">
|
||||||
<rsm:SpecifiedExchangedDocumentContext>
|
<rsm:SpecifiedExchangedDocumentContext>
|
||||||
<ram:TestIndicator>
|
<ram:TestIndicator>
|
||||||
@@ -45,6 +57,8 @@
|
|||||||
<ram:ID schemeID="VA">DE999999999</ram:ID>
|
<ram:ID schemeID="VA">DE999999999</ram:ID>
|
||||||
</ram:SpecifiedTaxRegistration>
|
</ram:SpecifiedTaxRegistration>
|
||||||
</ram:BuyerTradeParty>
|
</ram:BuyerTradeParty>
|
||||||
|
<ram:AdditionalReferencedDocument>
|
||||||
|
</ram:AdditionalReferencedDocument>
|
||||||
</ram:ApplicableSupplyChainTradeAgreement>
|
</ram:ApplicableSupplyChainTradeAgreement>
|
||||||
<ram:ApplicableSupplyChainTradeDelivery>
|
<ram:ApplicableSupplyChainTradeDelivery>
|
||||||
<ram:ActualDeliverySupplyChainEvent>
|
<ram:ActualDeliverySupplyChainEvent>
|
||||||
|
|||||||
Reference in New Issue
Block a user