diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java index 1be3c717..c470dbaf 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java @@ -128,42 +128,5 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase { } - public void testItemReferencedDocumentsImport() { - ZUGFeRDInvoiceImporter zii=new ZUGFeRDInvoiceImporter(); - - DocumentBuilderFactory db = DocumentBuilderFactory.newInstance(); - - boolean hasExceptions=false; - Invoice invoice=null; - try { - zii.doRecalculateItemPricesFromLineTotals(); - zii.doIgnoreCalculationErrors(); - zii.fromXML(new String(Files.readAllBytes(Paths.get(getResourceAsFile("factur-x-testImport-corrected.xml").getAbsolutePath())), StandardCharsets.UTF_8)); - invoice=zii.extractInvoice(); - } catch (XPathExpressionException | ParseException | IOException e) { - hasExceptions=true; - } - assertFalse(hasExceptions); - assertNotNull(invoice.getZFItems()[0].getReferencedDocuments()); - assertEquals(2, invoice.getZFItems()[0].getReferencedDocuments().length); - assertEquals("33807818630-5", invoice.getZFItems()[0].getReferencedDocuments()[0].getIssuerAssignedID()); - assertEquals("PL", invoice.getZFItems()[0].getReferencedDocuments()[1].getReferenceTypeCode()); - - ZUGFeRD2PullProvider zf2p = new ZUGFeRD2PullProvider(); - zf2p.setProfile(Profiles.getByName("Extended")); - zf2p.generateXML(invoice); - String theXML = new String(zf2p.getXML()); - try { - BufferedWriter writer = new BufferedWriter(new FileWriter("c:\\Users\\jstaerk\\Desktop\\xrechnung-written.xml")); - writer.write(theXML); - writer.close(); - } catch (IOException e) { - e.printStackTrace(); - } - - TransactionCalculator tc=new TransactionCalculator(invoice); -// assertEquals(new BigDecimal("1284.66"),tc.getGrandTotal()); - assertEquals(new BigDecimal("1284.40"),tc.getGrandTotal()); - } } diff --git a/validator/src/main/java/org/mustangproject/validator/XMLValidator.java b/validator/src/main/java/org/mustangproject/validator/XMLValidator.java index 5b603b1f..eeab8d51 100644 --- a/validator/src/main/java/org/mustangproject/validator/XMLValidator.java +++ b/validator/src/main/java/org/mustangproject/validator/XMLValidator.java @@ -18,6 +18,7 @@ import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathFactory; +import com.helger.schematron.svrl.jaxb.ActivePattern; import org.mustangproject.XMLTools; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -406,7 +407,7 @@ public class XMLValidator extends Validator { .setLocation(failedAssert.getLocation()).setCriterion(failedAssert.getTest()).setSection(section) .setPart(EPart.fx)); failedRules++; - } else if (object instanceof FiredRule) { + } else if ((object instanceof FiredRule)||(object instanceof ActivePattern)) { firedRules++; } } diff --git a/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java b/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java index 96c7582f..1f7f6fb0 100644 --- a/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java +++ b/validator/src/test/java/org/mustangproject/validator/XMLValidatorTest.java @@ -253,7 +253,7 @@ public class XMLValidatorTest extends ResourceCase { Source source = Input.fromString("" + xv.getXMLResult() + "").build(); String content = xpath.evaluate("/validation/summary/@status", source); - // assertEquals("valid", content); + assertEquals("valid", content); } catch (IrrecoverableValidationError e) {