From 9f4c12c6c24e7d716bd4a72aacdbf2b45c4203af Mon Sep 17 00:00:00 2001 From: langfr Date: Wed, 24 Jun 2026 21:16:40 +0100 Subject: [PATCH 1/2] Add another test for ExemptionReason --- .../validator/XMLValidatorTest.java | 21 ++- .../roundingDifferenceIsInTolerance.xml | 134 ++++++++++++++++++ 2 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 validator/src/test/resources/roundingDifferenceIsInTolerance.xml diff --git a/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java b/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java index 88094295..ca9ceeb5 100644 --- a/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java +++ b/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java @@ -475,9 +475,28 @@ public void testSubInvoiceLineHierarchy() { } catch (final IrrecoverableValidationError e) { // ignore, will be in XML output anyway } + } + public void testRoundingDifferenceIsInTolerance() { + final ValidationContext ctx = new ValidationContext(null); + final XMLValidator xv = new XMLValidator(ctx); + final XPathEngine xpath = new JAXPXPathEngine(); + File tempFile = getResourceAsFile("roundingDifferenceIsInTolerance.xml"); + boolean noExceptions = true; + try { + xv.setFilename(tempFile.getAbsolutePath()); + xv.validate(); - } + String s = "" + xv.getXMLResult() + ""; + Source source = Input.fromString(s).build(); + // must be valid overall + String status = xpath.evaluate("/validation/summary/@status", source); + assertEquals("valid", status); + } catch (IrrecoverableValidationError e) { + noExceptions = false; + } + assertTrue(noExceptions); + } } diff --git a/validator/src/test/resources/roundingDifferenceIsInTolerance.xml b/validator/src/test/resources/roundingDifferenceIsInTolerance.xml new file mode 100644 index 00000000..3f291f6b --- /dev/null +++ b/validator/src/test/resources/roundingDifferenceIsInTolerance.xml @@ -0,0 +1,134 @@ + + + + + urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended + + + + 57136 + 380 + + 20260131 + + + + + + 1 + + + xy à 72,50 € + + + + 60.9244 + 1.0000 + + + + 11.6667 + + + + VAT + Normalsatz + S + 19.00 + + + 710.79 + + + + + 57136 + + 3497103 + Fxy + + Fxy + + 06199-299 + + + info@fxy.de + + + + 61999 + Wiesbadener Str. 36A + XY + DE + + + 999/841/9999/5 + + + + text xy + + 99999 + Tannenweg 99 + xy + DE + + + + + + + + 20260126 + + + + + + EUR + + + 58 + Zahlung per SEPA Überweisung. + + DE2450050201020099999 + Fxy + + + HELADEF1822 + + + + 135.04 + VAT + 710.79 + S + 19.00 + + + + 20260105 + + + 20260126 + + + + Bitte begleichen Sie die Rechnung bis spätestens 07.02.2026 + + 20260207 + + + + 710.79 + 0.00 + 0.00 + 710.79 + 135.04 + 845.83 + 0.00 + 845.83 + + + + \ No newline at end of file From 5d4eabb02f150dd715accd5a7ac4dd373d7a58a6 Mon Sep 17 00:00:00 2001 From: langfr Date: Wed, 24 Jun 2026 21:27:28 +0100 Subject: [PATCH 2/2] Add another test for ExemptionReason --- .../java/org/mustangproject/validator/XMLValidatorTest.java | 6 ++++++ .../src/test/resources/roundingDifferenceIsInTolerance.xml | 1 + 2 files changed, 7 insertions(+) diff --git a/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java b/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java index ca9ceeb5..1e9e6c09 100644 --- a/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java +++ b/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java @@ -489,10 +489,16 @@ public void testRoundingDifferenceIsInTolerance() { xv.validate(); String s = "" + xv.getXMLResult() + ""; + System.out.println(s); Source source = Input.fromString(s).build(); // must be valid overall String status = xpath.evaluate("/validation/summary/@status", source); + + assertThat(s).valueByXPath("count(//warning)") + .asInt() + .isEqualTo(1); + assertEquals("valid", status); } catch (IrrecoverableValidationError e) { noExceptions = false; diff --git a/validator/src/test/resources/roundingDifferenceIsInTolerance.xml b/validator/src/test/resources/roundingDifferenceIsInTolerance.xml index 3f291f6b..5c2562fc 100644 --- a/validator/src/test/resources/roundingDifferenceIsInTolerance.xml +++ b/validator/src/test/resources/roundingDifferenceIsInTolerance.xml @@ -101,6 +101,7 @@ 135.04 VAT + Normalsatz 710.79 S 19.00