refactoring Transactioncalculator

This commit is contained in:
jstaerk
2020-10-31 18:16:10 +01:00
parent aaa106f09a
commit ede19a6b74
7 changed files with 340 additions and 308 deletions

View File

@@ -27,6 +27,9 @@ import junit.framework.TestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
import javax.xml.xpath.XPathExpressionException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -44,7 +47,14 @@ public class ZF2ZInvoiceImporterTest extends TestCase {
ZUGFeRDInvoiceImporter zii=new ZUGFeRDInvoiceImporter(TARGET_PDF);
Invoice invoice=zii.extractInvoice();
boolean hasExceptions=false;
Invoice invoice=null;
try {
invoice=zii.extractInvoice();
} catch (XPathExpressionException | ParseException e) {
hasExceptions=true;
}
assertFalse(hasExceptions);
// Reading ZUGFeRD
assertEquals("Bei Spiel GmbH", invoice.getOwnOrganisationName());
assertEquals(3, invoice.getZFItems().length);
@@ -71,6 +81,10 @@ public class ZF2ZInvoiceImporterTest extends TestCase {
assertEquals("DE", invoice.getSender().getCountry());
assertEquals("Stadthausen", invoice.getSender().getLocation());
TransactionCalculator tc=new TransactionCalculator(invoice);
assertEquals(new BigDecimal("571.040000"),tc.getTotalGross());
// name street location zip country, contact name phone email, total amount