count patterns as fired rules->testing UBL positive
This commit is contained in:
@@ -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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import javax.xml.xpath.XPathConstants;
|
|||||||
import javax.xml.xpath.XPathExpression;
|
import javax.xml.xpath.XPathExpression;
|
||||||
import javax.xml.xpath.XPathFactory;
|
import javax.xml.xpath.XPathFactory;
|
||||||
|
|
||||||
|
import com.helger.schematron.svrl.jaxb.ActivePattern;
|
||||||
import org.mustangproject.XMLTools;
|
import org.mustangproject.XMLTools;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -406,7 +407,7 @@ public class XMLValidator extends Validator {
|
|||||||
.setLocation(failedAssert.getLocation()).setCriterion(failedAssert.getTest()).setSection(section)
|
.setLocation(failedAssert.getLocation()).setCriterion(failedAssert.getTest()).setSection(section)
|
||||||
.setPart(EPart.fx));
|
.setPart(EPart.fx));
|
||||||
failedRules++;
|
failedRules++;
|
||||||
} else if (object instanceof FiredRule) {
|
} else if ((object instanceof FiredRule)||(object instanceof ActivePattern)) {
|
||||||
firedRules++;
|
firedRules++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ public class XMLValidatorTest extends ResourceCase {
|
|||||||
|
|
||||||
Source source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
|
Source source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
|
||||||
String content = xpath.evaluate("/validation/summary/@status", source);
|
String content = xpath.evaluate("/validation/summary/@status", source);
|
||||||
// assertEquals("valid", content);
|
assertEquals("valid", content);
|
||||||
|
|
||||||
|
|
||||||
} catch (IrrecoverableValidationError e) {
|
} catch (IrrecoverableValidationError e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user