added item tests
This commit is contained in:
@@ -272,12 +272,16 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
|||||||
public void testXRImport() {
|
public void testXRImport() {
|
||||||
boolean hasExceptions = false;
|
boolean hasExceptions = false;
|
||||||
|
|
||||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
|
ZUGFeRDImporter zii = new ZUGFeRDImporter();
|
||||||
|
|
||||||
|
int version=-1;
|
||||||
try {
|
try {
|
||||||
zii.fromXML(new String(Files.readAllBytes(Paths.get("./target/testout-XR-Edge.xml")), StandardCharsets.UTF_8));
|
zii.fromXML(new String(Files.readAllBytes(Paths.get("./target/testout-XR-Edge.xml")), StandardCharsets.UTF_8));
|
||||||
|
version=zii.getVersion();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
hasExceptions = true;
|
hasExceptions = true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Invoice invoice = null;
|
Invoice invoice = null;
|
||||||
@@ -287,8 +291,17 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
|||||||
hasExceptions = true;
|
hasExceptions = true;
|
||||||
}
|
}
|
||||||
assertFalse(hasExceptions);
|
assertFalse(hasExceptions);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TransactionCalculator tc = new TransactionCalculator(invoice);
|
TransactionCalculator tc = new TransactionCalculator(invoice);
|
||||||
assertEquals(new BigDecimal("1.00"), tc.getGrandTotal());
|
assertEquals(new BigDecimal("1.00"), tc.getGrandTotal());
|
||||||
|
|
||||||
|
assertEquals(version,2);
|
||||||
|
assertTrue(new BigDecimal("1").compareTo(invoice.getZFItems()[0].getQuantity()) == 0);
|
||||||
|
LineCalculator lc=new LineCalculator(invoice.getZFItems()[0]);
|
||||||
|
assertTrue(new BigDecimal("1").compareTo(lc.getItemTotalNetAmount()) == 0);
|
||||||
|
|
||||||
assertTrue(invoice.getTradeSettlement().length==1);
|
assertTrue(invoice.getTradeSettlement().length==1);
|
||||||
assertTrue(invoice.getTradeSettlement()[0] instanceof IZUGFeRDTradeSettlementPayment);
|
assertTrue(invoice.getTradeSettlement()[0] instanceof IZUGFeRDTradeSettlementPayment);
|
||||||
IZUGFeRDTradeSettlementPayment paym=(IZUGFeRDTradeSettlementPayment)invoice.getTradeSettlement()[0];
|
IZUGFeRDTradeSettlementPayment paym=(IZUGFeRDTradeSettlementPayment)invoice.getTradeSettlement()[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user