diff --git a/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java b/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java index 5477b25c..2fda10ef 100644 --- a/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java +++ b/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java @@ -204,6 +204,36 @@ public class XMLValidatorTest extends ResourceCase { } + public void testXRCIIPeppolFailureValidation() { + final ValidationContext ctx = new ValidationContext(null); + final XMLValidator xv = new XMLValidator(ctx); + final XPathEngine xpath = new JAXPXPathEngine(); + + // GIVEN XRechnung CII with Peppol rule violation + File file = getResourceAsFile("CII_XRechnung_with_Peppol_violation.xml"); + + boolean noExceptions = true; + try { + xv.setFilename(file.getAbsolutePath()); + + // WHEN validated + xv.validate(); + + Source source = Input.fromString("" + xv.getXMLResult() + "").build(); + + // THEN validation returns only warning message + boolean onlyWarnings = Boolean.parseBoolean(xpath.evaluate("not(//messages/*[not(self::warning)])", source)); + assertTrue(onlyWarnings); + + // THEN validation returns summary status valid + String status = xpath.evaluate("/validation/summary/@status", source); + assertEquals("valid", status); + } catch (IrrecoverableValidationError e) { + noExceptions = false; + } + assertTrue(noExceptions); + } + public void testXRValidation() { final ValidationContext ctx = new ValidationContext(null); final XMLValidator xv = new XMLValidator(ctx); diff --git a/validator/src/test/resources/CII_XRechnung_with_Peppol_violation.xml b/validator/src/test/resources/CII_XRechnung_with_Peppol_violation.xml new file mode 100644 index 00000000..8e023db5 --- /dev/null +++ b/validator/src/test/resources/CII_XRechnung_with_Peppol_violation.xml @@ -0,0 +1,144 @@ + + + + + urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 + + + urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0 + + + + RE0021 + 380 + + 20241002 + + + Rechnung + AFM + + + Unsere Lieferungen/Leistungen stellen wir Ihnen wie folgt in Rechnung. + AAI + + + Vielen Dank für die gute Zusammenarbeit. + SUR + + + + + + 1 + + + 1 + + + + 140.0000 + 1.0000 + + + + 1.0000 + + + + VAT + S + 19.00 + + + 140.00 + + + + + 992-90009-96 + + 231132 + Max Muster + + Max Muster + + 0192435345 + + + muster@example.com + + + + 12345 + Straße + Stadt + DE + + + muster@example.com + + + DE99999/99999 + + + DE325845615 + + + + KUnde + + 12345 + Straße + Stadt + DE + + + + + + + 20241002 + + + + + RE0021 + EUR + + 1 + Überweisung + + DE50110101002129646573 + Max Muster + + + BEVODEBBXXX + + + + 26.60 + VAT + 140.00 + S + 19.00 + + + Zahlbar sofort, rein netto + + 20241002 + + + + 140.00 + 0.00 + 0.00 + 140.00 + 26.60 + 166.60 + 0.00 + 166.60 + + + +