automated XR invoice importer test

This commit is contained in:
jstaerk
2022-05-16 10:47:12 +02:00
parent 219ecb892a
commit b5e0fb8710

View File

@@ -128,5 +128,28 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
} }
public void testXRImport() {
boolean hasExceptions=false;
ZUGFeRDInvoiceImporter zii=new ZUGFeRDInvoiceImporter();
try {
zii.fromXML(new String(Files.readAllBytes(Paths.get("./target/testout-XR-Edge.xml")), StandardCharsets.UTF_8));
} catch (IOException e) {
hasExceptions=true;
}
Invoice invoice=null;
try {
invoice=zii.extractInvoice();
} catch (XPathExpressionException | ParseException e) {
hasExceptions=true;
}
assertFalse(hasExceptions);
TransactionCalculator tc=new TransactionCalculator(invoice);
assertEquals(new BigDecimal("1.00"),tc.getGrandTotal());
}
} }