use .editorconfig for java

This commit is contained in:
Andre Kemper
2019-04-06 22:05:23 +02:00
parent d67a3058f3
commit a1732f4833
48 changed files with 4207 additions and 4208 deletions

View File

@@ -21,37 +21,37 @@ package org.mustangproject.ZUGFeRD;
import java.math.BigDecimal;
public class IZUGFeRDAllowanceChargeImpl implements IZUGFeRDAllowanceCharge {
private BigDecimal totalAmount;
private String reason;
private BigDecimal taxPercent;
private BigDecimal totalAmount;
private String reason;
private BigDecimal taxPercent;
@Override
public BigDecimal getTotalAmount() {
return totalAmount;
}
@Override
public BigDecimal getTotalAmount() {
return totalAmount;
}
@Override
public String getReason() {
return reason;
}
@Override
public String getReason() {
return reason;
}
@Override
public BigDecimal getTaxPercent() {
return taxPercent;
}
@Override
public BigDecimal getTaxPercent() {
return taxPercent;
}
public IZUGFeRDAllowanceChargeImpl setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
return this;
}
public IZUGFeRDAllowanceChargeImpl setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
return this;
}
public IZUGFeRDAllowanceChargeImpl setReason(String reason) {
this.reason = reason;
return this;
}
public IZUGFeRDAllowanceChargeImpl setReason(String reason) {
this.reason = reason;
return this;
}
public IZUGFeRDAllowanceChargeImpl setTaxPercent(BigDecimal taxPercent) {
this.taxPercent = taxPercent;
return this;
}
public IZUGFeRDAllowanceChargeImpl setTaxPercent(BigDecimal taxPercent) {
this.taxPercent = taxPercent;
return this;
}
}

View File

@@ -19,70 +19,70 @@
package org.mustangproject.ZUGFeRD;
public class IZUGFeRDExportableContactImpl implements IZUGFeRDExportableContact {
private String name;
private String zIP;
private String vATID;
private String country;
private String location;
private String street;
private String name;
private String zIP;
private String vATID;
private String country;
private String location;
private String street;
@Override
public String getName() {
return name;
}
@Override
public String getName() {
return name;
}
@Override
public String getZIP() {
return zIP;
}
@Override
public String getZIP() {
return zIP;
}
@Override
public String getVATID() {
return vATID;
}
@Override
public String getVATID() {
return vATID;
}
@Override
public String getCountry() {
return country;
}
@Override
public String getCountry() {
return country;
}
@Override
public String getLocation() {
return location;
}
@Override
public String getLocation() {
return location;
}
@Override
public String getStreet() {
return street;
}
@Override
public String getStreet() {
return street;
}
public IZUGFeRDExportableContactImpl setName(String name) {
this.name = name;
return this;
}
public IZUGFeRDExportableContactImpl setName(String name) {
this.name = name;
return this;
}
public IZUGFeRDExportableContactImpl setZIP(String zIP) {
this.zIP = zIP;
return this;
}
public IZUGFeRDExportableContactImpl setZIP(String zIP) {
this.zIP = zIP;
return this;
}
public IZUGFeRDExportableContactImpl setVATID(String vATID) {
this.vATID = vATID;
return this;
}
public IZUGFeRDExportableContactImpl setVATID(String vATID) {
this.vATID = vATID;
return this;
}
public IZUGFeRDExportableContactImpl setCountry(String country) {
this.country = country;
return this;
}
public IZUGFeRDExportableContactImpl setCountry(String country) {
this.country = country;
return this;
}
public IZUGFeRDExportableContactImpl setLocation(String location) {
this.location = location;
return this;
}
public IZUGFeRDExportableContactImpl setLocation(String location) {
this.location = location;
return this;
}
public IZUGFeRDExportableContactImpl setStreet(String street) {
this.street = street;
return this;
}
public IZUGFeRDExportableContactImpl setStreet(String street) {
this.street = street;
return this;
}
}

View File

@@ -21,59 +21,59 @@ package org.mustangproject.ZUGFeRD;
import java.math.BigDecimal;
public class IZUGFeRDExportableItemImpl implements IZUGFeRDExportableItem {
private IZUGFeRDExportableProduct product;
private IZUGFeRDAllowanceCharge[] itemAllowances;
private IZUGFeRDAllowanceCharge[] itemCharges;
private BigDecimal price;
private BigDecimal quantity;
private IZUGFeRDExportableProduct product;
private IZUGFeRDAllowanceCharge[] itemAllowances;
private IZUGFeRDAllowanceCharge[] itemCharges;
private BigDecimal price;
private BigDecimal quantity;
@Override
public IZUGFeRDExportableProduct getProduct() {
return product;
}
@Override
public IZUGFeRDExportableProduct getProduct() {
return product;
}
@Override
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
return itemAllowances;
}
@Override
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
return itemAllowances;
}
@Override
public IZUGFeRDAllowanceCharge[] getItemCharges() {
return itemCharges;
}
@Override
public IZUGFeRDAllowanceCharge[] getItemCharges() {
return itemCharges;
}
@Override
public BigDecimal getPrice() {
return price;
}
@Override
public BigDecimal getPrice() {
return price;
}
@Override
public BigDecimal getQuantity() {
return quantity;
}
@Override
public BigDecimal getQuantity() {
return quantity;
}
public IZUGFeRDExportableItemImpl setProduct(IZUGFeRDExportableProduct product) {
this.product = product;
return this;
}
public IZUGFeRDExportableItemImpl setProduct(IZUGFeRDExportableProduct product) {
this.product = product;
return this;
}
public IZUGFeRDExportableItemImpl setItemAllowances(IZUGFeRDAllowanceCharge[] itemAllowances) {
this.itemAllowances = itemAllowances;
return this;
}
public IZUGFeRDExportableItemImpl setItemAllowances(IZUGFeRDAllowanceCharge[] itemAllowances) {
this.itemAllowances = itemAllowances;
return this;
}
public IZUGFeRDExportableItemImpl setItemCharges(IZUGFeRDAllowanceCharge[] itemCharges) {
this.itemCharges = itemCharges;
return this;
}
public IZUGFeRDExportableItemImpl setItemCharges(IZUGFeRDAllowanceCharge[] itemCharges) {
this.itemCharges = itemCharges;
return this;
}
public IZUGFeRDExportableItemImpl setPrice(BigDecimal price) {
this.price = price;
return this;
}
public IZUGFeRDExportableItemImpl setPrice(BigDecimal price) {
this.price = price;
return this;
}
public IZUGFeRDExportableItemImpl setQuantity(BigDecimal quantity) {
this.quantity = quantity;
return this;
}
public IZUGFeRDExportableItemImpl setQuantity(BigDecimal quantity) {
this.quantity = quantity;
return this;
}
}

View File

@@ -21,48 +21,48 @@ package org.mustangproject.ZUGFeRD;
import java.math.BigDecimal;
public class IZUGFeRDExportableProductImpl implements IZUGFeRDExportableProduct {
private String unit;
private String name;
private String description;
private BigDecimal vatPercent;
private String unit;
private String name;
private String description;
private BigDecimal vatPercent;
@Override
public String getUnit() {
return unit;
}
@Override
public String getUnit() {
return unit;
}
@Override
public String getName() {
return name;
}
@Override
public String getName() {
return name;
}
@Override
public String getDescription() {
return description;
}
@Override
public String getDescription() {
return description;
}
@Override
public BigDecimal getVATPercent() {
return vatPercent;
}
@Override
public BigDecimal getVATPercent() {
return vatPercent;
}
public IZUGFeRDExportableProductImpl setUnit(String unit) {
this.unit = unit;
return this;
}
public IZUGFeRDExportableProductImpl setUnit(String unit) {
this.unit = unit;
return this;
}
public IZUGFeRDExportableProductImpl setName(String name) {
this.name = name;
return this;
}
public IZUGFeRDExportableProductImpl setName(String name) {
this.name = name;
return this;
}
public IZUGFeRDExportableProductImpl setDescription(String description) {
this.description = description;
return this;
}
public IZUGFeRDExportableProductImpl setDescription(String description) {
this.description = description;
return this;
}
public IZUGFeRDExportableProductImpl setVatPercent(BigDecimal vatPercent) {
this.vatPercent = vatPercent;
return this;
}
public IZUGFeRDExportableProductImpl setVatPercent(BigDecimal vatPercent) {
this.vatPercent = vatPercent;
return this;
}
}

View File

@@ -21,290 +21,290 @@ package org.mustangproject.ZUGFeRD;
import java.util.Date;
public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTransaction {
private String number;
private Date issueDate;
private String ownOrganisationFullPlaintextInfo;
private Date dueDate;
private IZUGFeRDAllowanceCharge[] zFAllowances;
private IZUGFeRDAllowanceCharge[] zFCharges;
private IZUGFeRDAllowanceCharge[] zFLogisticsServiceCharges;
private IZUGFeRDExportableItem[] zFItems;
private IZUGFeRDExportableContact recipient;
private String ownKto;
private String ownBLZ;
private String ownBIC;
private String ownBankName;
private String ownIBAN;
private String ownTaxID;
private String ownVATID;
private String ownOrganisationName;
private String ownStreet;
private String ownZIP;
private String ownLocation;
private String ownCountry;
private Date deliveryDate;
private String currency;
private String ownPaymentInfoText;
private String paymentTermDescription;
private String referenceNumber;
private String number;
private Date issueDate;
private String ownOrganisationFullPlaintextInfo;
private Date dueDate;
private IZUGFeRDAllowanceCharge[] zFAllowances;
private IZUGFeRDAllowanceCharge[] zFCharges;
private IZUGFeRDAllowanceCharge[] zFLogisticsServiceCharges;
private IZUGFeRDExportableItem[] zFItems;
private IZUGFeRDExportableContact recipient;
private String ownKto;
private String ownBLZ;
private String ownBIC;
private String ownBankName;
private String ownIBAN;
private String ownTaxID;
private String ownVATID;
private String ownOrganisationName;
private String ownStreet;
private String ownZIP;
private String ownLocation;
private String ownCountry;
private Date deliveryDate;
private String currency;
private String ownPaymentInfoText;
private String paymentTermDescription;
private String referenceNumber;
@Override
public String getNumber() {
return number;
}
@Override
public String getNumber() {
return number;
}
@Override
public Date getIssueDate() {
return issueDate;
}
@Override
public Date getIssueDate() {
return issueDate;
}
@Override
public String getOwnOrganisationFullPlaintextInfo() {
return ownOrganisationFullPlaintextInfo;
}
@Override
public String getOwnOrganisationFullPlaintextInfo() {
return ownOrganisationFullPlaintextInfo;
}
@Override
public Date getDueDate() {
return dueDate;
}
@Override
public Date getDueDate() {
return dueDate;
}
@Override
public IZUGFeRDAllowanceCharge[] getZFAllowances() {
return zFAllowances;
}
@Override
public IZUGFeRDAllowanceCharge[] getZFAllowances() {
return zFAllowances;
}
@Override
public IZUGFeRDAllowanceCharge[] getZFCharges() {
return zFCharges;
}
@Override
public IZUGFeRDAllowanceCharge[] getZFCharges() {
return zFCharges;
}
@Override
public IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges() {
return zFLogisticsServiceCharges;
}
@Override
public IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges() {
return zFLogisticsServiceCharges;
}
@Override
public IZUGFeRDExportableItem[] getZFItems() {
return zFItems;
}
@Override
public IZUGFeRDExportableItem[] getZFItems() {
return zFItems;
}
@Override
public IZUGFeRDExportableContact getRecipient() {
return recipient;
}
@Override
public IZUGFeRDExportableContact getRecipient() {
return recipient;
}
@Override
public String getOwnKto() {
return ownKto;
}
@Override
public String getOwnKto() {
return ownKto;
}
@Override
public String getOwnBLZ() {
return ownBLZ;
}
@Override
public String getOwnBLZ() {
return ownBLZ;
}
@Override
public String getOwnBIC() {
return ownBIC;
}
@Override
public String getOwnBIC() {
return ownBIC;
}
@Override
public String getOwnBankName() {
return ownBankName;
}
@Override
public String getOwnBankName() {
return ownBankName;
}
@Override
public String getOwnIBAN() {
return ownIBAN;
}
@Override
public String getOwnIBAN() {
return ownIBAN;
}
@Override
public String getOwnTaxID() {
return ownTaxID;
}
@Override
public String getOwnTaxID() {
return ownTaxID;
}
@Override
public String getOwnVATID() {
return ownVATID;
}
@Override
public String getOwnVATID() {
return ownVATID;
}
@Override
public String getOwnOrganisationName() {
return ownOrganisationName;
}
@Override
public String getOwnOrganisationName() {
return ownOrganisationName;
}
@Override
public String getOwnStreet() {
return ownStreet;
}
@Override
public String getOwnStreet() {
return ownStreet;
}
@Override
public String getOwnZIP() {
return ownZIP;
}
@Override
public String getOwnZIP() {
return ownZIP;
}
@Override
public String getOwnLocation() {
return ownLocation;
}
@Override
public String getOwnLocation() {
return ownLocation;
}
@Override
public String getOwnCountry() {
return ownCountry;
}
@Override
public String getOwnCountry() {
return ownCountry;
}
@Override
public Date getDeliveryDate() {
return deliveryDate;
}
@Override
public Date getDeliveryDate() {
return deliveryDate;
}
@Override
public String getCurrency() {
return currency;
}
@Override
public String getCurrency() {
return currency;
}
@Override
public String getOwnPaymentInfoText() {
return ownPaymentInfoText;
}
@Override
public String getOwnPaymentInfoText() {
return ownPaymentInfoText;
}
@Override
public String getPaymentTermDescription() {
return paymentTermDescription;
}
@Override
public String getPaymentTermDescription() {
return paymentTermDescription;
}
@Override
public String getReferenceNumber() {
return referenceNumber;
}
@Override
public String getReferenceNumber() {
return referenceNumber;
}
public IZUGFeRDExportableTransactionImpl setNumber(String number) {
this.number = number;
return this;
}
public IZUGFeRDExportableTransactionImpl setNumber(String number) {
this.number = number;
return this;
}
public IZUGFeRDExportableTransactionImpl setIssueDate(Date issueDate) {
this.issueDate = issueDate;
return this;
}
public IZUGFeRDExportableTransactionImpl setIssueDate(Date issueDate) {
this.issueDate = issueDate;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnOrganisationFullPlaintextInfo(String ownOrganisationFullPlaintextInfo) {
this.ownOrganisationFullPlaintextInfo = ownOrganisationFullPlaintextInfo;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnOrganisationFullPlaintextInfo(String ownOrganisationFullPlaintextInfo) {
this.ownOrganisationFullPlaintextInfo = ownOrganisationFullPlaintextInfo;
return this;
}
public IZUGFeRDExportableTransactionImpl setDueDate(Date dueDate) {
this.dueDate = dueDate;
return this;
}
public IZUGFeRDExportableTransactionImpl setDueDate(Date dueDate) {
this.dueDate = dueDate;
return this;
}
public IZUGFeRDExportableTransactionImpl setZFAllowances(IZUGFeRDAllowanceCharge... zFAllowances) {
this.zFAllowances = zFAllowances;
return this;
}
public IZUGFeRDExportableTransactionImpl setZFAllowances(IZUGFeRDAllowanceCharge... zFAllowances) {
this.zFAllowances = zFAllowances;
return this;
}
public IZUGFeRDExportableTransactionImpl setZFCharges(IZUGFeRDAllowanceCharge... zFCharges) {
this.zFCharges = zFCharges;
return this;
}
public IZUGFeRDExportableTransactionImpl setZFCharges(IZUGFeRDAllowanceCharge... zFCharges) {
this.zFCharges = zFCharges;
return this;
}
public IZUGFeRDExportableTransactionImpl setZFLogisticsServiceCharges(IZUGFeRDAllowanceCharge... zFLogisticsServiceCharges) {
this.zFLogisticsServiceCharges = zFLogisticsServiceCharges;
return this;
}
public IZUGFeRDExportableTransactionImpl setZFLogisticsServiceCharges(IZUGFeRDAllowanceCharge... zFLogisticsServiceCharges) {
this.zFLogisticsServiceCharges = zFLogisticsServiceCharges;
return this;
}
public IZUGFeRDExportableTransactionImpl setZFItems(IZUGFeRDExportableItem... zFItems) {
this.zFItems = zFItems;
return this;
}
public IZUGFeRDExportableTransactionImpl setZFItems(IZUGFeRDExportableItem... zFItems) {
this.zFItems = zFItems;
return this;
}
public IZUGFeRDExportableTransactionImpl setRecipient(IZUGFeRDExportableContact recipient) {
this.recipient = recipient;
return this;
}
public IZUGFeRDExportableTransactionImpl setRecipient(IZUGFeRDExportableContact recipient) {
this.recipient = recipient;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnBLZ(String ownBLZ) {
this.ownBLZ = ownBLZ;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnBLZ(String ownBLZ) {
this.ownBLZ = ownBLZ;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnBIC(String ownBIC) {
this.ownBIC = ownBIC;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnBIC(String ownBIC) {
this.ownBIC = ownBIC;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnBankName(String ownBankName) {
this.ownBankName = ownBankName;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnBankName(String ownBankName) {
this.ownBankName = ownBankName;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnKto(String ownKto) {
this.ownKto = ownKto;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnKto(String ownKto) {
this.ownKto = ownKto;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnIBAN(String ownIBAN) {
this.ownIBAN = ownIBAN;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnIBAN(String ownIBAN) {
this.ownIBAN = ownIBAN;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnTaxID(String ownTaxID) {
this.ownTaxID = ownTaxID;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnTaxID(String ownTaxID) {
this.ownTaxID = ownTaxID;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnVATID(String ownVATID) {
this.ownVATID = ownVATID;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnVATID(String ownVATID) {
this.ownVATID = ownVATID;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnOrganisationName(String ownOrganisationName) {
this.ownOrganisationName = ownOrganisationName;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnOrganisationName(String ownOrganisationName) {
this.ownOrganisationName = ownOrganisationName;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnStreet(String ownStreet) {
this.ownStreet = ownStreet;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnStreet(String ownStreet) {
this.ownStreet = ownStreet;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnZIP(String ownZIP) {
this.ownZIP = ownZIP;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnZIP(String ownZIP) {
this.ownZIP = ownZIP;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnLocation(String ownLocation) {
this.ownLocation = ownLocation;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnLocation(String ownLocation) {
this.ownLocation = ownLocation;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnCountry(String ownCountry) {
this.ownCountry = ownCountry;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnCountry(String ownCountry) {
this.ownCountry = ownCountry;
return this;
}
public IZUGFeRDExportableTransactionImpl setDeliveryDate(Date deliveryDate) {
this.deliveryDate = deliveryDate;
return this;
}
public IZUGFeRDExportableTransactionImpl setDeliveryDate(Date deliveryDate) {
this.deliveryDate = deliveryDate;
return this;
}
public IZUGFeRDExportableTransactionImpl setCurrency(String currency) {
this.currency = currency;
return this;
}
public IZUGFeRDExportableTransactionImpl setCurrency(String currency) {
this.currency = currency;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnPaymentInfoText(String ownPaymentInfoText) {
this.ownPaymentInfoText = ownPaymentInfoText;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnPaymentInfoText(String ownPaymentInfoText) {
this.ownPaymentInfoText = ownPaymentInfoText;
return this;
}
public IZUGFeRDExportableTransactionImpl setPaymentTermDescription(String paymentTermDescription) {
this.paymentTermDescription = paymentTermDescription;
return this;
}
public IZUGFeRDExportableTransactionImpl setPaymentTermDescription(String paymentTermDescription) {
this.paymentTermDescription = paymentTermDescription;
return this;
}
public IZUGFeRDExportableTransactionImpl setReferenceNumber(String referenceNumber) {
this.referenceNumber = referenceNumber;
return this;
}
public IZUGFeRDExportableTransactionImpl setReferenceNumber(String referenceNumber) {
this.referenceNumber = referenceNumber;
return this;
}
}

View File

@@ -34,8 +34,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
/**
* Create the test case
*
* @param testName
* name of the test case
* @param testName name of the test case
*/
public MustangReaderWriterCustomXMLTest(String testName) {
super(testName);
@@ -50,7 +49,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
// //////// TESTS
// //////////////////////////////////////////////////////////////////////////////////////////
public void testCustomZF2Export() throws Exception {
public void testCustomZF2Export() throws Exception {
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20171118_506custom.pdf";
// the writing part
@@ -61,210 +60,210 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
ZUGFeRDExporter zea1 = new ZUGFeRDExporterFromA1Factory().setProducer("My Application").setCreator("Test").setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel.EN16931)
.load(SOURCE_PDF);
final byte[] UTF8ByteOrderMark = new byte[] { (byte)0xef, (byte)0xbb,
(byte)0xbf };
final byte[] UTF8ByteOrderMark = new byte[]{(byte) 0xef, (byte) 0xbb,
(byte) 0xbf};
/* we have much more information than just in the basic profile (comfort or extended) but it's perfectly valid to provide more information, just not less. */
String ownZUGFeRDXML = new String(UTF8ByteOrderMark)+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<rsm:CrossIndustryInvoice xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\">\n" +
" <rsm:ExchangedDocumentContext>\n" +
" <ram:TestIndicator><udt:Indicator>false</udt:Indicator></ram:TestIndicator>\n" +
" <ram:GuidelineSpecifiedDocumentContextParameter>\n" +
" <ram:ID>urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:extended</ram:ID>\n" +
" </ram:GuidelineSpecifiedDocumentContextParameter>\n" +
" </rsm:ExchangedDocumentContext>\n" +
" <rsm:ExchangedDocument>\n" +
" <ram:ID>RE-20171118/506</ram:ID>\n" +
" <ram:Name>RECHNUNG</ram:Name>\n" +
" <ram:TypeCode>380</ram:TypeCode>\n" +
" <ram:IssueDateTime><udt:DateTimeString format=\"102\">20171118</udt:DateTimeString></ram:IssueDateTime>\n" +
" </rsm:ExchangedDocument>\n" +
" <rsm:SupplyChainTradeTransaction>\n" +
" <ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:AssociatedDocumentLineDocument>\n" +
" <ram:LineID>1</ram:LineID>\n" +
" </ram:AssociatedDocumentLineDocument>\n" +
" <ram:SpecifiedTradeProduct>\n" +
" <ram:Name>Künstlerische Gestaltung (Stunde): Einer Beispielrechnung</ram:Name>\n" +
" <ram:Description></ram:Description>\n" +
" </ram:SpecifiedTradeProduct>\n" +
" <ram:SpecifiedLineTradeAgreement>\n" +
" <ram:GrossPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">160.0000</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"HUR\">1.0000</ram:BasisQuantity>\n" +
" </ram:GrossPriceProductTradePrice>\n" +
" <ram:NetPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">160.0000</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"HUR\">1.0000</ram:BasisQuantity>\n" +
" </ram:NetPriceProductTradePrice>\n" +
" </ram:SpecifiedLineTradeAgreement>\n" +
" <ram:SpecifiedLineTradeDelivery>\n" +
" <ram:BilledQuantity unitCode=\"HUR\">1.0000</ram:BilledQuantity>\n" +
" </ram:SpecifiedLineTradeDelivery>\n" +
" <ram:SpecifiedLineTradeSettlement>\n" +
" <ram:ApplicableTradeTax>\n" +
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
" <ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>\n" +
" </ram:ApplicableTradeTax>\n" +
" <ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" <ram:LineTotalAmount currencyID=\"EUR\">160.00</ram:LineTotalAmount>\n" +
" </ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" </ram:SpecifiedLineTradeSettlement>\n" +
" </ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:AssociatedDocumentLineDocument>\n" +
" <ram:LineID>2</ram:LineID>\n" +
" </ram:AssociatedDocumentLineDocument>\n" +
" <ram:SpecifiedTradeProduct>\n" +
" <ram:Name>Luftballon: Bunt, ca. 500ml</ram:Name>\n" +
" <ram:Description></ram:Description>\n" +
" </ram:SpecifiedTradeProduct>\n" +
" <ram:SpecifiedLineTradeAgreement>\n" +
" <ram:GrossPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">0.7900</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"C62\">1.0000</ram:BasisQuantity>\n" +
" </ram:GrossPriceProductTradePrice>\n" +
" <ram:NetPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">0.7900</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"C62\">1.0000</ram:BasisQuantity>\n" +
" </ram:NetPriceProductTradePrice>\n" +
" </ram:SpecifiedLineTradeAgreement>\n" +
" <ram:SpecifiedLineTradeDelivery>\n" +
" <ram:BilledQuantity unitCode=\"C62\">400.0000</ram:BilledQuantity>\n" +
" </ram:SpecifiedLineTradeDelivery>\n" +
" <ram:SpecifiedLineTradeSettlement>\n" +
" <ram:ApplicableTradeTax>\n" +
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
" <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
" </ram:ApplicableTradeTax>\n" +
" <ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" <ram:LineTotalAmount currencyID=\"EUR\">316.00</ram:LineTotalAmount>\n" +
" </ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" </ram:SpecifiedLineTradeSettlement>\n" +
" </ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:AssociatedDocumentLineDocument>\n" +
" <ram:LineID>3</ram:LineID>\n" +
" </ram:AssociatedDocumentLineDocument>\n" +
" <ram:SpecifiedTradeProduct>\n" +
" <ram:Name>Heiße Luft pro Liter</ram:Name>\n" +
" <ram:Description></ram:Description>\n" +
" </ram:SpecifiedTradeProduct>\n" +
" <ram:SpecifiedLineTradeAgreement>\n" +
" <ram:GrossPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">0.1000</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"LTR\">1.0000</ram:BasisQuantity>\n" +
" </ram:GrossPriceProductTradePrice>\n" +
" <ram:NetPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">0.1000</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"LTR\">1.0000</ram:BasisQuantity>\n" +
" </ram:NetPriceProductTradePrice>\n" +
" </ram:SpecifiedLineTradeAgreement>\n" +
" <ram:SpecifiedLineTradeDelivery>\n" +
" <ram:BilledQuantity unitCode=\"LTR\">200.0000</ram:BilledQuantity>\n" +
" </ram:SpecifiedLineTradeDelivery>\n" +
" <ram:SpecifiedLineTradeSettlement>\n" +
" <ram:ApplicableTradeTax>\n" +
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
" <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
" </ram:ApplicableTradeTax>\n" +
" <ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" <ram:LineTotalAmount currencyID=\"EUR\">20.00</ram:LineTotalAmount>\n" +
" </ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" </ram:SpecifiedLineTradeSettlement>\n" +
" </ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:ApplicableHeaderTradeAgreement>\n" +
" <ram:SellerTradeParty>\n" +
" <ram:Name>Bei Spiel GmbH</ram:Name>\n" +
" <ram:PostalTradeAddress>\n" +
" <ram:PostcodeCode>12345</ram:PostcodeCode>\n" +
" <ram:LineOne>Ecke 12</ram:LineOne>\n" +
" <ram:CityName>Stadthausen</ram:CityName>\n" +
" <ram:CountryID>DE</ram:CountryID>\n" +
" </ram:PostalTradeAddress>\n" +
" <ram:SpecifiedTaxRegistration>\n" +
" <ram:ID schemeID=\"FC\">22/815/0815/4</ram:ID>\n" +
" </ram:SpecifiedTaxRegistration>\n" +
" <ram:SpecifiedTaxRegistration>\n" +
" <ram:ID schemeID=\"VA\">DE136695976</ram:ID>\n" +
" </ram:SpecifiedTaxRegistration>\n" +
" </ram:SellerTradeParty>\n" +
" <ram:BuyerTradeParty>\n" +
" <ram:Name>Theodor Est</ram:Name>\n" +
" <ram:PostalTradeAddress>\n" +
" <ram:PostcodeCode>88802</ram:PostcodeCode>\n" +
" <ram:LineOne>Bahnstr. 42</ram:LineOne>\n" +
" <ram:CityName>Spielkreis</ram:CityName>\n" +
" <ram:CountryID>DE</ram:CountryID>\n" +
" </ram:PostalTradeAddress>\n" +
" <ram:SpecifiedTaxRegistration>\n" +
" <ram:ID schemeID=\"VA\">DE999999999</ram:ID>\n" +
" </ram:SpecifiedTaxRegistration>\n" +
" </ram:BuyerTradeParty>\n" +
" </ram:ApplicableHeaderTradeAgreement>\n" +
" <ram:ApplicableHeaderTradeDelivery>\n" +
" <ram:ActualDeliverySupplyChainEvent>\n" +
" <ram:OccurrenceDateTime><udt:DateTimeString format=\"102\">20171117</udt:DateTimeString></ram:OccurrenceDateTime>\n" +
" </ram:ActualDeliverySupplyChainEvent>\n" +
" </ram:ApplicableHeaderTradeDelivery>\n" +
" <ram:ApplicableHeaderTradeSettlement>\n" +
" <ram:PaymentReference>RE-20171118/506</ram:PaymentReference>\n" +
" <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>\n" +
" <ram:SpecifiedTradeSettlementPaymentMeans>\n" +
" <ram:TypeCode>42</ram:TypeCode>\n" +
" <ram:Information>Überweisung</ram:Information>\n" +
" <ram:PayeePartyCreditorFinancialAccount>\n" +
String ownZUGFeRDXML = new String(UTF8ByteOrderMark) + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<rsm:CrossIndustryInvoice xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100\">\n" +
" <rsm:ExchangedDocumentContext>\n" +
" <ram:TestIndicator><udt:Indicator>false</udt:Indicator></ram:TestIndicator>\n" +
" <ram:GuidelineSpecifiedDocumentContextParameter>\n" +
" <ram:ID>urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:extended</ram:ID>\n" +
" </ram:GuidelineSpecifiedDocumentContextParameter>\n" +
" </rsm:ExchangedDocumentContext>\n" +
" <rsm:ExchangedDocument>\n" +
" <ram:ID>RE-20171118/506</ram:ID>\n" +
" <ram:Name>RECHNUNG</ram:Name>\n" +
" <ram:TypeCode>380</ram:TypeCode>\n" +
" <ram:IssueDateTime><udt:DateTimeString format=\"102\">20171118</udt:DateTimeString></ram:IssueDateTime>\n" +
" </rsm:ExchangedDocument>\n" +
" <rsm:SupplyChainTradeTransaction>\n" +
" <ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:AssociatedDocumentLineDocument>\n" +
" <ram:LineID>1</ram:LineID>\n" +
" </ram:AssociatedDocumentLineDocument>\n" +
" <ram:SpecifiedTradeProduct>\n" +
" <ram:Name>Künstlerische Gestaltung (Stunde): Einer Beispielrechnung</ram:Name>\n" +
" <ram:Description></ram:Description>\n" +
" </ram:SpecifiedTradeProduct>\n" +
" <ram:SpecifiedLineTradeAgreement>\n" +
" <ram:GrossPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">160.0000</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"HUR\">1.0000</ram:BasisQuantity>\n" +
" </ram:GrossPriceProductTradePrice>\n" +
" <ram:NetPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">160.0000</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"HUR\">1.0000</ram:BasisQuantity>\n" +
" </ram:NetPriceProductTradePrice>\n" +
" </ram:SpecifiedLineTradeAgreement>\n" +
" <ram:SpecifiedLineTradeDelivery>\n" +
" <ram:BilledQuantity unitCode=\"HUR\">1.0000</ram:BilledQuantity>\n" +
" </ram:SpecifiedLineTradeDelivery>\n" +
" <ram:SpecifiedLineTradeSettlement>\n" +
" <ram:ApplicableTradeTax>\n" +
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
" <ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>\n" +
" </ram:ApplicableTradeTax>\n" +
" <ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" <ram:LineTotalAmount currencyID=\"EUR\">160.00</ram:LineTotalAmount>\n" +
" </ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" </ram:SpecifiedLineTradeSettlement>\n" +
" </ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:AssociatedDocumentLineDocument>\n" +
" <ram:LineID>2</ram:LineID>\n" +
" </ram:AssociatedDocumentLineDocument>\n" +
" <ram:SpecifiedTradeProduct>\n" +
" <ram:Name>Luftballon: Bunt, ca. 500ml</ram:Name>\n" +
" <ram:Description></ram:Description>\n" +
" </ram:SpecifiedTradeProduct>\n" +
" <ram:SpecifiedLineTradeAgreement>\n" +
" <ram:GrossPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">0.7900</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"C62\">1.0000</ram:BasisQuantity>\n" +
" </ram:GrossPriceProductTradePrice>\n" +
" <ram:NetPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">0.7900</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"C62\">1.0000</ram:BasisQuantity>\n" +
" </ram:NetPriceProductTradePrice>\n" +
" </ram:SpecifiedLineTradeAgreement>\n" +
" <ram:SpecifiedLineTradeDelivery>\n" +
" <ram:BilledQuantity unitCode=\"C62\">400.0000</ram:BilledQuantity>\n" +
" </ram:SpecifiedLineTradeDelivery>\n" +
" <ram:SpecifiedLineTradeSettlement>\n" +
" <ram:ApplicableTradeTax>\n" +
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
" <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
" </ram:ApplicableTradeTax>\n" +
" <ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" <ram:LineTotalAmount currencyID=\"EUR\">316.00</ram:LineTotalAmount>\n" +
" </ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" </ram:SpecifiedLineTradeSettlement>\n" +
" </ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:AssociatedDocumentLineDocument>\n" +
" <ram:LineID>3</ram:LineID>\n" +
" </ram:AssociatedDocumentLineDocument>\n" +
" <ram:SpecifiedTradeProduct>\n" +
" <ram:Name>Heiße Luft pro Liter</ram:Name>\n" +
" <ram:Description></ram:Description>\n" +
" </ram:SpecifiedTradeProduct>\n" +
" <ram:SpecifiedLineTradeAgreement>\n" +
" <ram:GrossPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">0.1000</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"LTR\">1.0000</ram:BasisQuantity>\n" +
" </ram:GrossPriceProductTradePrice>\n" +
" <ram:NetPriceProductTradePrice>\n" +
" <ram:ChargeAmount currencyID=\"EUR\">0.1000</ram:ChargeAmount>\n" +
" <ram:BasisQuantity unitCode=\"LTR\">1.0000</ram:BasisQuantity>\n" +
" </ram:NetPriceProductTradePrice>\n" +
" </ram:SpecifiedLineTradeAgreement>\n" +
" <ram:SpecifiedLineTradeDelivery>\n" +
" <ram:BilledQuantity unitCode=\"LTR\">200.0000</ram:BilledQuantity>\n" +
" </ram:SpecifiedLineTradeDelivery>\n" +
" <ram:SpecifiedLineTradeSettlement>\n" +
" <ram:ApplicableTradeTax>\n" +
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
" <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
" </ram:ApplicableTradeTax>\n" +
" <ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" <ram:LineTotalAmount currencyID=\"EUR\">20.00</ram:LineTotalAmount>\n" +
" </ram:SpecifiedTradeSettlementLineMonetarySummation>\n" +
" </ram:SpecifiedLineTradeSettlement>\n" +
" </ram:IncludedSupplyChainTradeLineItem>\n" +
" <ram:ApplicableHeaderTradeAgreement>\n" +
" <ram:SellerTradeParty>\n" +
" <ram:Name>Bei Spiel GmbH</ram:Name>\n" +
" <ram:PostalTradeAddress>\n" +
" <ram:PostcodeCode>12345</ram:PostcodeCode>\n" +
" <ram:LineOne>Ecke 12</ram:LineOne>\n" +
" <ram:CityName>Stadthausen</ram:CityName>\n" +
" <ram:CountryID>DE</ram:CountryID>\n" +
" </ram:PostalTradeAddress>\n" +
" <ram:SpecifiedTaxRegistration>\n" +
" <ram:ID schemeID=\"FC\">22/815/0815/4</ram:ID>\n" +
" </ram:SpecifiedTaxRegistration>\n" +
" <ram:SpecifiedTaxRegistration>\n" +
" <ram:ID schemeID=\"VA\">DE136695976</ram:ID>\n" +
" </ram:SpecifiedTaxRegistration>\n" +
" </ram:SellerTradeParty>\n" +
" <ram:BuyerTradeParty>\n" +
" <ram:Name>Theodor Est</ram:Name>\n" +
" <ram:PostalTradeAddress>\n" +
" <ram:PostcodeCode>88802</ram:PostcodeCode>\n" +
" <ram:LineOne>Bahnstr. 42</ram:LineOne>\n" +
" <ram:CityName>Spielkreis</ram:CityName>\n" +
" <ram:CountryID>DE</ram:CountryID>\n" +
" </ram:PostalTradeAddress>\n" +
" <ram:SpecifiedTaxRegistration>\n" +
" <ram:ID schemeID=\"VA\">DE999999999</ram:ID>\n" +
" </ram:SpecifiedTaxRegistration>\n" +
" </ram:BuyerTradeParty>\n" +
" </ram:ApplicableHeaderTradeAgreement>\n" +
" <ram:ApplicableHeaderTradeDelivery>\n" +
" <ram:ActualDeliverySupplyChainEvent>\n" +
" <ram:OccurrenceDateTime><udt:DateTimeString format=\"102\">20171117</udt:DateTimeString></ram:OccurrenceDateTime>\n" +
" </ram:ActualDeliverySupplyChainEvent>\n" +
" </ram:ApplicableHeaderTradeDelivery>\n" +
" <ram:ApplicableHeaderTradeSettlement>\n" +
" <ram:PaymentReference>RE-20171118/506</ram:PaymentReference>\n" +
" <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>\n" +
" <ram:SpecifiedTradeSettlementPaymentMeans>\n" +
" <ram:TypeCode>42</ram:TypeCode>\n" +
" <ram:Information>Überweisung</ram:Information>\n" +
" <ram:PayeePartyCreditorFinancialAccount>\n" +
" <ram:IBANID>DE88 2008 0000 0970 3757 00</ram:IBANID>\n" +
" <ram:ProprietaryID>44421800</ram:ProprietaryID>\n" +
" </ram:PayeePartyCreditorFinancialAccount>\n" +
" <ram:PayeeSpecifiedCreditorFinancialInstitution>\n" +
" <ram:PayeeSpecifiedCreditorFinancialInstitution>\n" +
" <ram:BICID>COBADEFFXXX</ram:BICID>\n" +
" <ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>\n" +
" <ram:Name>Commerzbank</ram:Name>\n" +
" </ram:PayeeSpecifiedCreditorFinancialInstitution>\n" +
" </ram:SpecifiedTradeSettlementPaymentMeans>\n" +
" <ram:ApplicableTradeTax>\n" +
" <ram:CalculatedAmount currencyID=\"EUR\">11.20</ram:CalculatedAmount>\n" +
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
" <ram:BasisAmount currencyID=\"EUR\">160.00</ram:BasisAmount>\n" +
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
" <ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>\n" +
" </ram:ApplicableTradeTax>\n" +
" <ram:ApplicableTradeTax>\n" +
" <ram:CalculatedAmount currencyID=\"EUR\">63.84</ram:CalculatedAmount>\n" +
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
" <ram:BasisAmount currencyID=\"EUR\">336.00</ram:BasisAmount>\n" +
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
" <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
" </ram:ApplicableTradeTax>\n" +
" <ram:SpecifiedTradePaymentTerms>\n" +
" <ram:Description>Zahlbar ohne Abzug bis 09.12.2017</ram:Description>\n" +
" <ram:DueDateDateTime><udt:DateTimeString format=\"102\">20171209</udt:DateTimeString></ram:DueDateDateTime>\n" +
" </ram:SpecifiedTradePaymentTerms>\n" +
" <ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n" +
" <ram:LineTotalAmount currencyID=\"EUR\">496.00</ram:LineTotalAmount>\n" +
" <ram:ChargeTotalAmount currencyID=\"EUR\">0.00</ram:ChargeTotalAmount>\n" +
" <ram:AllowanceTotalAmount currencyID=\"EUR\">0.00</ram:AllowanceTotalAmount>\n" +
" <ram:TaxBasisTotalAmount currencyID=\"EUR\">496.00</ram:TaxBasisTotalAmount>\n" +
" <ram:TaxTotalAmount currencyID=\"EUR\">75.04</ram:TaxTotalAmount>\n" +
" <ram:GrandTotalAmount currencyID=\"EUR\">571.04</ram:GrandTotalAmount>\n" +
" <ram:DuePayableAmount currencyID=\"EUR\">571.04</ram:DuePayableAmount>\n" +
" </ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n" +
" </ram:ApplicableHeaderTradeSettlement>\n" +
" </rsm:SupplyChainTradeTransaction>\n" +
" <ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>\n" +
" <ram:Name>Commerzbank</ram:Name>\n" +
" </ram:PayeeSpecifiedCreditorFinancialInstitution>\n" +
" </ram:SpecifiedTradeSettlementPaymentMeans>\n" +
" <ram:ApplicableTradeTax>\n" +
" <ram:CalculatedAmount currencyID=\"EUR\">11.20</ram:CalculatedAmount>\n" +
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
" <ram:BasisAmount currencyID=\"EUR\">160.00</ram:BasisAmount>\n" +
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
" <ram:RateApplicablePercent>7.00</ram:RateApplicablePercent>\n" +
" </ram:ApplicableTradeTax>\n" +
" <ram:ApplicableTradeTax>\n" +
" <ram:CalculatedAmount currencyID=\"EUR\">63.84</ram:CalculatedAmount>\n" +
" <ram:TypeCode>VAT</ram:TypeCode>\n" +
" <ram:BasisAmount currencyID=\"EUR\">336.00</ram:BasisAmount>\n" +
" <ram:CategoryCode>S</ram:CategoryCode>\n" +
" <ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>\n" +
" </ram:ApplicableTradeTax>\n" +
" <ram:SpecifiedTradePaymentTerms>\n" +
" <ram:Description>Zahlbar ohne Abzug bis 09.12.2017</ram:Description>\n" +
" <ram:DueDateDateTime><udt:DateTimeString format=\"102\">20171209</udt:DateTimeString></ram:DueDateDateTime>\n" +
" </ram:SpecifiedTradePaymentTerms>\n" +
" <ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n" +
" <ram:LineTotalAmount currencyID=\"EUR\">496.00</ram:LineTotalAmount>\n" +
" <ram:ChargeTotalAmount currencyID=\"EUR\">0.00</ram:ChargeTotalAmount>\n" +
" <ram:AllowanceTotalAmount currencyID=\"EUR\">0.00</ram:AllowanceTotalAmount>\n" +
" <ram:TaxBasisTotalAmount currencyID=\"EUR\">496.00</ram:TaxBasisTotalAmount>\n" +
" <ram:TaxTotalAmount currencyID=\"EUR\">75.04</ram:TaxTotalAmount>\n" +
" <ram:GrandTotalAmount currencyID=\"EUR\">571.04</ram:GrandTotalAmount>\n" +
" <ram:DuePayableAmount currencyID=\"EUR\">571.04</ram:DuePayableAmount>\n" +
" </ram:SpecifiedTradeSettlementHeaderMonetarySummation>\n" +
" </ram:ApplicableHeaderTradeSettlement>\n" +
" </rsm:SupplyChainTradeTransaction>\n" +
"</rsm:CrossIndustryInvoice>";
zea1.setZUGFeRDXMLData(ownZUGFeRDXML.getBytes("UTF-8"));
zea1.setZUGFeRDXMLData(ownZUGFeRDXML.getBytes("UTF-8"));
ByteArrayOutputStream baos=new ByteArrayOutputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
zea1.disableAutoClose(true);
zea1.export(TARGET_PDF);
zea1.export(baos);
zea1.close();
String pdfContent=baos.toString("UTF-8");
assertFalse(pdfContent.indexOf("(via mustangproject.org")==-1);
String pdfContent = baos.toString("UTF-8");
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);
} catch (IOException e) {
@@ -279,31 +278,32 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
String amount = null;
String bic = null;
String blz = null;
String blz = null;
String iban = null;
String kto = null;
String kto = null;
String holder = null;
String ref = null;
if (zi.canParse()) {
zi.parse();
amount = zi.getAmount();
blz = zi.getBLZ();
blz = zi.getBLZ();
bic = zi.getBIC();
iban = zi.getIBAN();
kto = zi.getKTO();
kto = zi.getKTO();
holder = zi.getHolder();
ref = zi.getForeignReference();
}
assertEquals(amount, "571.04");
assertEquals(blz, "41441604");
assertEquals(blz, "41441604");
assertEquals(bic, "COBADEFFXXX");
assertEquals(iban, "DE88 2008 0000 0970 3757 00");
assertEquals(kto, "44421800");
assertEquals(holder, "Bei Spiel GmbH");
assertEquals(ref, "RE-20171118/506");
}
/**
* The exporter test bases on @{code
* ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds
@@ -362,10 +362,10 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
+ "<ram:ProprietaryID>44421800</ram:ProprietaryID>\n"
+ "</ram:PayeePartyCreditorFinancialAccount>\n"
+ "<ram:PayeeSpecifiedCreditorFinancialInstitution>\n"
+ "<ram:BICID>COBADEFFXXX</ram:BICID>\n"
+ "<ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>\n"
+ "<ram:BICID>COBADEFFXXX</ram:BICID>\n"
+ "<ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>\n"
+ "<ram:Name>Commerzbank</ram:Name>\n"
+ "</ram:PayeeSpecifiedCreditorFinancialInstitution>\n"
+ "</ram:PayeeSpecifiedCreditorFinancialInstitution>\n"
+ "</ram:SpecifiedTradeSettlementPaymentMeans>\n" + "<ram:ApplicableTradeTax>\n"
+ "<ram:CalculatedAmount currencyID=\"EUR\">11.20</ram:CalculatedAmount>\n"
+ "<ram:TypeCode>VAT</ram:TypeCode>\n"
@@ -459,13 +459,13 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
+ "</rsm:SpecifiedSupplyChainTradeTransaction>\n" + "</rsm:CrossIndustryDocument>";
zea1.setZUGFeRDXMLData(ownZUGFeRDXML.getBytes("UTF-8"));
ByteArrayOutputStream baos=new ByteArrayOutputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
zea1.disableAutoClose(true);
zea1.export(TARGET_PDF);
zea1.export(baos);
zea1.close();
String pdfContent=baos.toString("UTF-8");
assertFalse(pdfContent.indexOf("(via mustangproject.org")==-1);
String pdfContent = baos.toString("UTF-8");
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>BASIC</zf:ConformanceLevel>") == -1);
} catch (IOException e) {
@@ -480,7 +480,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
String amount = null;
String bic = null;
String blz = null;
String blz = null;
String iban = null;
String kto = null;
String holder = null;
@@ -490,7 +490,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
zi.parse();
amount = zi.getAmount();
bic = zi.getBIC();
blz = zi.getBLZ();
blz = zi.getBLZ();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
@@ -499,7 +499,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
assertEquals(amount, "571.04");
assertEquals(bic, "COBADEFFXXX");
assertEquals(blz, "41441604");
assertEquals(blz, "41441604");
assertEquals(iban, "DE88 2008 0000 0970 3757 00");
assertEquals(kto, "44421800");
assertEquals(holder, "Bei Spiel GmbH");

View File

@@ -33,457 +33,405 @@ import java.util.Date;
import java.util.GregorianCalendar;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExportableTransaction
{
@Override
public Date getDeliveryDate()
{
return new GregorianCalendar(2017, Calendar.MAY, 7).getTime();
}
@Override
public Date getDueDate()
{
return new GregorianCalendar(2017, Calendar.MAY, 30).getTime();
}
@Override
public Date getIssueDate()
{
return new GregorianCalendar(2017, Calendar.MAY, 9).getTime();
}
@Override
public String getNumber()
{
return "RE-20170509/505";
}
@Override
public String getOwnKto()
{
return "44421800";
}
@Override
public String getOwnBLZ()
{
return "41441604";
}
@Override
public String getOwnBIC()
{
return "COBADEFFXXX";
}
@Override
public String getOwnBankName()
{
return "Commerzbank";
}
@Override
public String getOwnCountry()
{
return "DE";
}
@Override
public String getOwnIBAN()
{
return "DE88 2008 0000 0970 3757 00";
}
@Override
public String getOwnLocation()
{
return "Stadthausen";
}
@Override
public String getOwnOrganisationName()
{
return "Bei Spiel GmbH";
}
@Override
public String getOwnStreet()
{
return "Ecke 12";
}
@Override
public String getOwnTaxID()
{
return "22/815/0815/4";
}
@Override
public String getOwnVATID()
{
return "DE136695976";
}
@Override
public String getOwnZIP()
{
return "12345";
}
@Override
public IZUGFeRDExportableContact getRecipient()
{
return new Contact();
}
@Override
public String getOwnOrganisationFullPlaintextInfo()
{
return null;
}
@Override
public String getCurrency()
{
return "EUR";
}
@Override
public IZUGFeRDExportableItem[] getZFItems()
{
Item[] allItems = new Item[3];
Product designProduct = new Product("", "Künstlerische Gestaltung (Stunde): Einer Beispielrechnung", "HUR", new BigDecimal("7.000000"));
Product balloonProduct = new Product("", "Luftballon: Bunt, ca. 500ml", "C62", new BigDecimal("19.000000"));
Product airProduct = new Product("", "Heiße Luft pro Liter", "LTR", new BigDecimal("19.000000"));
allItems[0] = new Item(new BigDecimal("160"), new BigDecimal("1"), designProduct);
allItems[1] = new Item(new BigDecimal("0.79"), new BigDecimal("400"), balloonProduct);
allItems[2] = new Item(new BigDecimal("0.10"), new BigDecimal("200"), airProduct);
return allItems;
}
@Override
public String getOwnPaymentInfoText() {
return "Überweisung";
}
@Override
public String getPaymentTermDescription() {
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
return "Zahlbar ohne Abzug bis zum " + germanDateFormat.format(getDueDate());
}
@Override
public IZUGFeRDAllowanceCharge[] getZFAllowances() {
return null;
}
@Override
public IZUGFeRDAllowanceCharge[] getZFCharges() {
return null;
}
@Override
public IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges() {
return null;
}
@Override
public String getReferenceNumber() {
return null;
}
class Contact implements IZUGFeRDExportableContact
{
@Override
public String getCountry()
{
return "DE";
}
@Override
public String getLocation()
{
return "Spielkreis";
}
@Override
public String getName()
{
return "Theodor Est";
}
@Override
public String getStreet()
{
return "Bahnstr. 42";
}
@Override
public String getVATID()
{
return "DE999999999";
}
@Override
public String getZIP()
{
return "88802";
}
}
class Item implements IZUGFeRDExportableItem
{
public Item(BigDecimal price, BigDecimal quantity, Product product)
{
super();
this.price = price;
this.quantity = quantity;
this.product = product;
}
private BigDecimal price,quantity;
private Product product;
@Override
public BigDecimal getPrice()
{
return price;
}
public void setPrice(BigDecimal price)
{
this.price = price;
}
@Override
public BigDecimal getQuantity()
{
return quantity;
}
public void setQuantity(BigDecimal quantity)
{
this.quantity = quantity;
}
@Override
public Product getProduct()
{
return product;
}
public void setProduct(Product product)
{
this.product = product;
}
@Override
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
return null;
}
@Override
public IZUGFeRDAllowanceCharge[] getItemCharges() {
return null;
}
}
class Product implements IZUGFeRDExportableProduct
{
private String description, name, unit;
private BigDecimal VATPercent;
public Product(String description, String name, String unit, BigDecimal VATPercent)
{
super();
this.description = description;
this.name = name;
this.unit = unit;
this.VATPercent = VATPercent;
}
@Override
public String getDescription()
{
return description;
}
public void setDescription(String description)
{
this.description = description;
}
@Override
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
@Override
public String getUnit()
{
return unit;
}
public void setUnit(String unit)
{
this.unit = unit;
}
@Override
public BigDecimal getVATPercent()
{
return VATPercent;
}
public void setVATPercent(BigDecimal vATPercent)
{
VATPercent = vATPercent;
}
}
/**
* Create the test case
*
* @param testName
* name of the test case
*/
public MustangReaderWriterEdgeTest(String testName)
{
super(testName);
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite(MustangReaderWriterEdgeTest.class);
}
// //////// TESTS //////////////////////////////////////////////////////////////////////////////////////////
/**
* The importer test imports from ./src/test/MustangGnuaccountingBeispielRE-20170509_505.pdf to check the values.
* --> as only Name Ascending is supported for Test Unit sequence, I renamed the this test-A-Export to run before
* testZExport
*
* @throws IOException
*/
public void testAImport() throws IOException
{
ZUGFeRDImporter zi = new ZUGFeRDImporter();
zi.extractLowLevel(this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf"));
// Reading ZUGFeRD
String amount = null;
String bic = null;
String blz = null;
String iban = null;
String kto = null;
String holder = null;
String ref = null;
String dueDate = null;
if (zi.canParse())
{
zi.parse();
amount = zi.getAmount();
bic = zi.getBIC();
blz = zi.getBLZ();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
dueDate = zi.getDueDate();
ref = zi.getForeignReference();
}
assertEquals(amount, "571.04");
assertEquals(bic, getOwnBIC());
assertEquals(blz, getOwnBLZ());
assertEquals(iban, getOwnIBAN());
assertEquals(kto, getOwnKto());
assertEquals(holder, getOwnOrganisationName());
assertEquals(dueDate, "20170530");
assertEquals(ref, getNumber());
}
/**
* The exporter test bases on @{code ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds metadata,
* writes
* to @{code ./target/testout-*} and then imports to check the values.
* It would not make sense to have it run before the less complex importer test (which is probably redundant)
* --> as only Name Ascending is supported for Test Unit sequence, I renamed the Exporter Test test-Z-Export
*/
public void testEdgeExport() throws Exception {
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20170509_505newEdge.pdf";
// the writing part
try(InputStream SOURCE_PDF =
this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505PDFA3.pdf");
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA3Factory()
.setProducer("My Application")
.setCreator(System.getProperty("user.name"))
.ignorePDFAErrors()
.load(SOURCE_PDF)) {
ze.setZUGFeRDVersion(1);
ze.PDFattachZugferdFile(this);
String theXML=new String(ze.getProvider().getXML());
assertTrue(theXML.contains("<rsm:CrossIndustryDocument"));
ze.export(TARGET_PDF);
}
// now check the contents (like MustangReaderTest)
ZUGFeRDImporter zi = new ZUGFeRDImporter();
zi.extract(TARGET_PDF);
// Reading ZUGFeRD
String amount = null;
String bic = null;
String blz = null;
String iban = null;
String kto = null;
String holder = null;
String ref = null;
if (zi.canParse())
{
zi.parse();
amount = zi.getAmount();
bic = zi.getBIC();
blz = zi.getBLZ();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
ref = zi.getForeignReference();
}
assertEquals(amount, "571.04");
assertEquals(bic, getOwnBIC());
assertEquals(blz, getOwnBLZ());
assertEquals(iban, getOwnIBAN());
assertEquals(kto, getOwnKto());
assertEquals(holder, getOwnOrganisationName());
assertEquals(ref, getNumber());
}
public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExportableTransaction {
@Override
public Date getDeliveryDate() {
return new GregorianCalendar(2017, Calendar.MAY, 7).getTime();
}
@Override
public Date getDueDate() {
return new GregorianCalendar(2017, Calendar.MAY, 30).getTime();
}
@Override
public Date getIssueDate() {
return new GregorianCalendar(2017, Calendar.MAY, 9).getTime();
}
@Override
public String getNumber() {
return "RE-20170509/505";
}
@Override
public String getOwnKto() {
return "44421800";
}
@Override
public String getOwnBLZ() {
return "41441604";
}
@Override
public String getOwnBIC() {
return "COBADEFFXXX";
}
@Override
public String getOwnBankName() {
return "Commerzbank";
}
@Override
public String getOwnCountry() {
return "DE";
}
@Override
public String getOwnIBAN() {
return "DE88 2008 0000 0970 3757 00";
}
@Override
public String getOwnLocation() {
return "Stadthausen";
}
@Override
public String getOwnOrganisationName() {
return "Bei Spiel GmbH";
}
@Override
public String getOwnStreet() {
return "Ecke 12";
}
@Override
public String getOwnTaxID() {
return "22/815/0815/4";
}
@Override
public String getOwnVATID() {
return "DE136695976";
}
@Override
public String getOwnZIP() {
return "12345";
}
@Override
public IZUGFeRDExportableContact getRecipient() {
return new Contact();
}
@Override
public String getOwnOrganisationFullPlaintextInfo() {
return null;
}
@Override
public String getCurrency() {
return "EUR";
}
@Override
public IZUGFeRDExportableItem[] getZFItems() {
Item[] allItems = new Item[3];
Product designProduct = new Product("", "Künstlerische Gestaltung (Stunde): Einer Beispielrechnung", "HUR", new BigDecimal("7.000000"));
Product balloonProduct = new Product("", "Luftballon: Bunt, ca. 500ml", "C62", new BigDecimal("19.000000"));
Product airProduct = new Product("", "Heiße Luft pro Liter", "LTR", new BigDecimal("19.000000"));
allItems[0] = new Item(new BigDecimal("160"), new BigDecimal("1"), designProduct);
allItems[1] = new Item(new BigDecimal("0.79"), new BigDecimal("400"), balloonProduct);
allItems[2] = new Item(new BigDecimal("0.10"), new BigDecimal("200"), airProduct);
return allItems;
}
@Override
public String getOwnPaymentInfoText() {
return "Überweisung";
}
@Override
public String getPaymentTermDescription() {
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
return "Zahlbar ohne Abzug bis zum " + germanDateFormat.format(getDueDate());
}
@Override
public IZUGFeRDAllowanceCharge[] getZFAllowances() {
return null;
}
@Override
public IZUGFeRDAllowanceCharge[] getZFCharges() {
return null;
}
@Override
public IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges() {
return null;
}
@Override
public String getReferenceNumber() {
return null;
}
class Contact implements IZUGFeRDExportableContact {
@Override
public String getCountry() {
return "DE";
}
@Override
public String getLocation() {
return "Spielkreis";
}
@Override
public String getName() {
return "Theodor Est";
}
@Override
public String getStreet() {
return "Bahnstr. 42";
}
@Override
public String getVATID() {
return "DE999999999";
}
@Override
public String getZIP() {
return "88802";
}
}
class Item implements IZUGFeRDExportableItem {
public Item(BigDecimal price, BigDecimal quantity, Product product) {
super();
this.price = price;
this.quantity = quantity;
this.product = product;
}
private BigDecimal price, quantity;
private Product product;
@Override
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
@Override
public BigDecimal getQuantity() {
return quantity;
}
public void setQuantity(BigDecimal quantity) {
this.quantity = quantity;
}
@Override
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
@Override
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
return null;
}
@Override
public IZUGFeRDAllowanceCharge[] getItemCharges() {
return null;
}
}
class Product implements IZUGFeRDExportableProduct {
private String description, name, unit;
private BigDecimal VATPercent;
public Product(String description, String name, String unit, BigDecimal VATPercent) {
super();
this.description = description;
this.name = name;
this.unit = unit;
this.VATPercent = VATPercent;
}
@Override
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
@Override
public BigDecimal getVATPercent() {
return VATPercent;
}
public void setVATPercent(BigDecimal vATPercent) {
VATPercent = vATPercent;
}
}
/**
* Create the test case
*
* @param testName name of the test case
*/
public MustangReaderWriterEdgeTest(String testName) {
super(testName);
}
/**
* @return the suite of tests being tested
*/
public static Test suite() {
return new TestSuite(MustangReaderWriterEdgeTest.class);
}
// //////// TESTS //////////////////////////////////////////////////////////////////////////////////////////
/**
* The importer test imports from ./src/test/MustangGnuaccountingBeispielRE-20170509_505.pdf to check the values.
* --> as only Name Ascending is supported for Test Unit sequence, I renamed the this test-A-Export to run before
* testZExport
*
* @throws IOException
*/
public void testAImport() throws IOException {
ZUGFeRDImporter zi = new ZUGFeRDImporter();
zi.extractLowLevel(this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf"));
// Reading ZUGFeRD
String amount = null;
String bic = null;
String blz = null;
String iban = null;
String kto = null;
String holder = null;
String ref = null;
String dueDate = null;
if (zi.canParse()) {
zi.parse();
amount = zi.getAmount();
bic = zi.getBIC();
blz = zi.getBLZ();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
dueDate = zi.getDueDate();
ref = zi.getForeignReference();
}
assertEquals(amount, "571.04");
assertEquals(bic, getOwnBIC());
assertEquals(blz, getOwnBLZ());
assertEquals(iban, getOwnIBAN());
assertEquals(kto, getOwnKto());
assertEquals(holder, getOwnOrganisationName());
assertEquals(dueDate, "20170530");
assertEquals(ref, getNumber());
}
/**
* The exporter test bases on @{code ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds metadata,
* writes
* to @{code ./target/testout-*} and then imports to check the values.
* It would not make sense to have it run before the less complex importer test (which is probably redundant)
* --> as only Name Ascending is supported for Test Unit sequence, I renamed the Exporter Test test-Z-Export
*/
public void testEdgeExport() throws Exception {
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20170509_505newEdge.pdf";
// the writing part
try (InputStream SOURCE_PDF =
this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505PDFA3.pdf");
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA3Factory()
.setProducer("My Application")
.setCreator(System.getProperty("user.name"))
.ignorePDFAErrors()
.load(SOURCE_PDF)) {
ze.setZUGFeRDVersion(1);
ze.PDFattachZugferdFile(this);
String theXML = new String(ze.getProvider().getXML());
assertTrue(theXML.contains("<rsm:CrossIndustryDocument"));
ze.export(TARGET_PDF);
}
// now check the contents (like MustangReaderTest)
ZUGFeRDImporter zi = new ZUGFeRDImporter();
zi.extract(TARGET_PDF);
// Reading ZUGFeRD
String amount = null;
String bic = null;
String blz = null;
String iban = null;
String kto = null;
String holder = null;
String ref = null;
if (zi.canParse()) {
zi.parse();
amount = zi.getAmount();
bic = zi.getBIC();
blz = zi.getBLZ();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
ref = zi.getForeignReference();
}
assertEquals(amount, "571.04");
assertEquals(bic, getOwnBIC());
assertEquals(blz, getOwnBLZ());
assertEquals(iban, getOwnIBAN());
assertEquals(kto, getOwnKto());
assertEquals(holder, getOwnOrganisationName());
assertEquals(ref, getNumber());
}
}

View File

@@ -57,17 +57,17 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
return "RE-20171118/506";
}
@Override
public String getOwnKto() {
return "44421800";
}
@Override
public String getOwnKto() {
return "44421800";
}
@Override
public String getOwnBLZ() {
return "41441604";
}
@Override
public String getOwnBLZ() {
return "41441604";
}
@Override
@Override
public String getOwnBIC() {
return "COBADEFFXXX";
}
@@ -320,8 +320,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
/**
* Create the test case
*
* @param testName
* name of the test case
* @param testName name of the test case
*/
public MustangReaderWriterTest(String testName) {
super(testName);
@@ -356,7 +355,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
// Reading ZUGFeRD
String amount = null;
String blz = null;
String blz = null;
String bic = null;
String iban = null;
String kto = null;
@@ -366,7 +365,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
if (zi.canParse()) {
zi.parse();
amount = zi.getAmount();
blz = zi.getBLZ();
blz = zi.getBLZ();
bic = zi.getBIC();
iban = zi.getIBAN();
kto = zi.getKTO();
@@ -376,7 +375,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
// this resembles the data written in MustangReaderWriterCustomXMLTest
assertEquals(amount, "571.04");
assertEquals(blz, "41441604");
assertEquals(bic, "COBADEFFXXX");
assertEquals(bic, "COBADEFFXXX");
assertEquals(iban, "DE88 2008 0000 0970 3757 00");
assertEquals(kto, "44421800");
assertEquals(holder, "Bei Spiel GmbH");
@@ -386,95 +385,94 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
public void testForeignImport() throws IOException {
ZUGFeRDImporter zi = new ZUGFeRDImporter();
try (InputStream inputStream = this.getClass()
.getResourceAsStream("/zugferd_invoice.pdf")) {
zi.extractLowLevel(inputStream);
}
// Reading ZUGFeRD
String amount = zi.getAmount();
assertEquals("<?xpacket begin=\"\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n" +
" <x:xmpmeta xmlns:x=\"adobe:ns:meta/\">\n" +
" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" +
" <rdf:Description rdf:about=\"\" xmlns:xmpMM=\"http://ns.adobe.com/xap/1.0/mm/\">\n" +
" <xmpMM:InstanceID>uuid:6776DD95-DAF6-768E-DAE6-2697750D95C5</xmpMM:InstanceID>\n" +
" <xmpMM:DocumentID>uuid:47380404-5938-FE2C-8F0B-B505DCE43BF5</xmpMM:DocumentID>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:zf=\"urn:ferd:pdfa:CrossIndustryDocument:invoice:1p0#\">\n" +
" <zf:ConformanceLevel>BASIC</zf:ConformanceLevel>\n" +
" <zf:DocumentFileName>ZUGFeRD-invoice.xml</zf:DocumentFileName>\n" +
" <zf:DocumentType>INVOICE</zf:DocumentType>\n" +
" <zf:Version>1.0</zf:Version>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:pdfaExtension=\"http://www.aiim.org/pdfa/ns/extension/\" xmlns:pdfaSchema=\"http://www.aiim.org/pdfa/ns/schema#\" xmlns:pdfaProperty=\"http://www.aiim.org/pdfa/ns/property#\">\n" +
" <pdfaExtension:schemas>\n" +
" <rdf:Bag>\n" +
" <rdf:li rdf:parseType=\"Resource\">\n" +
" <pdfaSchema:schema>ZUGFeRD PDFA Extension Schema</pdfaSchema:schema>\n" +
" <pdfaSchema:namespaceURI>urn:ferd:pdfa:CrossIndustryDocument:invoice:1p0#</pdfaSchema:namespaceURI>\n" +
" <pdfaSchema:prefix>zf</pdfaSchema:prefix>\n" +
" <pdfaSchema:property>\n" +
" <rdf:Seq>\n" +
" <rdf:li rdf:parseType=\"Resource\">\n" +
" <pdfaProperty:name>DocumentFileName</pdfaProperty:name>\n" +
" <pdfaProperty:valueType>Text</pdfaProperty:valueType>\n" +
" <pdfaProperty:category>external</pdfaProperty:category>\n" +
" <pdfaProperty:description>name of the embedded XML invoice file</pdfaProperty:description>\n" +
" </rdf:li>\n" +
" <rdf:li rdf:parseType=\"Resource\">\n" +
" <pdfaProperty:name>DocumentType</pdfaProperty:name>\n" +
" <pdfaProperty:valueType>Text</pdfaProperty:valueType>\n" +
" <pdfaProperty:category>external</pdfaProperty:category>\n" +
" <pdfaProperty:description>INVOICE</pdfaProperty:description>\n" +
" </rdf:li>\n" +
" <rdf:li rdf:parseType=\"Resource\">\n" +
" <pdfaProperty:name>Version</pdfaProperty:name>\n" +
" <pdfaProperty:valueType>Text</pdfaProperty:valueType>\n" +
" <pdfaProperty:category>external</pdfaProperty:category>\n" +
" <pdfaProperty:description>The actual version of the ZUGFeRD XML schema</pdfaProperty:description>\n" +
" </rdf:li>\n" +
" <rdf:li rdf:parseType=\"Resource\">\n" +
" <pdfaProperty:name>ConformanceLevel</pdfaProperty:name>\n" +
" <pdfaProperty:valueType>Text</pdfaProperty:valueType>\n" +
" <pdfaProperty:category>external</pdfaProperty:category>\n" +
" <pdfaProperty:description>The conformance level of the embedded ZUGFeRD data</pdfaProperty:description>\n" +
" </rdf:li>\n" +
" </rdf:Seq>\n" +
" </pdfaSchema:property>\n" +
" </rdf:li>\n" +
" </rdf:Bag>\n" +
" </pdfaExtension:schemas>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:pdfaid=\"http://www.aiim.org/pdfa/ns/id/\">\n" +
" <pdfaid:part>3</pdfaid:part>\n" +
" <pdfaid:conformance>B</pdfaid:conformance>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\">\n" +
" <xmp:CreateDate>2014-07-11T13:39:46+02:00</xmp:CreateDate>\n" +
" <xmp:ModifyDate>2014-07-11T13:39:46+02:00</xmp:ModifyDate>\n" +
" <xmp:CreatorTool>zugferd_invoice.java</xmp:CreatorTool>\n" +
" <xmp:MetadataDate>2014-07-11T13:39:46+02:00</xmp:MetadataDate>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\">\n" +
" <pdf:Producer>PDFlib Personalization Server 9.0.3 (JDK 1.6/Mac OS X-10.6 64)</pdf:Producer>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n" +
" <dc:title>\n" +
" <rdf:Alt>\n" +
" <rdf:li xml:lang=\"x-default\">ZUGFeRD Rechnung $Revision: 1.13 $</rdf:li>\n" +
" </rdf:Alt>\n" +
" </dc:title>\n" +
" </rdf:Description>\n" +
" </rdf:RDF>\n" +
" </x:xmpmeta>\n" +
String amount = zi.getAmount();
assertEquals("<?xpacket begin=\"\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n" +
" <x:xmpmeta xmlns:x=\"adobe:ns:meta/\">\n" +
" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" +
" <rdf:Description rdf:about=\"\" xmlns:xmpMM=\"http://ns.adobe.com/xap/1.0/mm/\">\n" +
" <xmpMM:InstanceID>uuid:6776DD95-DAF6-768E-DAE6-2697750D95C5</xmpMM:InstanceID>\n" +
" <xmpMM:DocumentID>uuid:47380404-5938-FE2C-8F0B-B505DCE43BF5</xmpMM:DocumentID>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:zf=\"urn:ferd:pdfa:CrossIndustryDocument:invoice:1p0#\">\n" +
" <zf:ConformanceLevel>BASIC</zf:ConformanceLevel>\n" +
" <zf:DocumentFileName>ZUGFeRD-invoice.xml</zf:DocumentFileName>\n" +
" <zf:DocumentType>INVOICE</zf:DocumentType>\n" +
" <zf:Version>1.0</zf:Version>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:pdfaExtension=\"http://www.aiim.org/pdfa/ns/extension/\" xmlns:pdfaSchema=\"http://www.aiim.org/pdfa/ns/schema#\" xmlns:pdfaProperty=\"http://www.aiim.org/pdfa/ns/property#\">\n" +
" <pdfaExtension:schemas>\n" +
" <rdf:Bag>\n" +
" <rdf:li rdf:parseType=\"Resource\">\n" +
" <pdfaSchema:schema>ZUGFeRD PDFA Extension Schema</pdfaSchema:schema>\n" +
" <pdfaSchema:namespaceURI>urn:ferd:pdfa:CrossIndustryDocument:invoice:1p0#</pdfaSchema:namespaceURI>\n" +
" <pdfaSchema:prefix>zf</pdfaSchema:prefix>\n" +
" <pdfaSchema:property>\n" +
" <rdf:Seq>\n" +
" <rdf:li rdf:parseType=\"Resource\">\n" +
" <pdfaProperty:name>DocumentFileName</pdfaProperty:name>\n" +
" <pdfaProperty:valueType>Text</pdfaProperty:valueType>\n" +
" <pdfaProperty:category>external</pdfaProperty:category>\n" +
" <pdfaProperty:description>name of the embedded XML invoice file</pdfaProperty:description>\n" +
" </rdf:li>\n" +
" <rdf:li rdf:parseType=\"Resource\">\n" +
" <pdfaProperty:name>DocumentType</pdfaProperty:name>\n" +
" <pdfaProperty:valueType>Text</pdfaProperty:valueType>\n" +
" <pdfaProperty:category>external</pdfaProperty:category>\n" +
" <pdfaProperty:description>INVOICE</pdfaProperty:description>\n" +
" </rdf:li>\n" +
" <rdf:li rdf:parseType=\"Resource\">\n" +
" <pdfaProperty:name>Version</pdfaProperty:name>\n" +
" <pdfaProperty:valueType>Text</pdfaProperty:valueType>\n" +
" <pdfaProperty:category>external</pdfaProperty:category>\n" +
" <pdfaProperty:description>The actual version of the ZUGFeRD XML schema</pdfaProperty:description>\n" +
" </rdf:li>\n" +
" <rdf:li rdf:parseType=\"Resource\">\n" +
" <pdfaProperty:name>ConformanceLevel</pdfaProperty:name>\n" +
" <pdfaProperty:valueType>Text</pdfaProperty:valueType>\n" +
" <pdfaProperty:category>external</pdfaProperty:category>\n" +
" <pdfaProperty:description>The conformance level of the embedded ZUGFeRD data</pdfaProperty:description>\n" +
" </rdf:li>\n" +
" </rdf:Seq>\n" +
" </pdfaSchema:property>\n" +
" </rdf:li>\n" +
" </rdf:Bag>\n" +
" </pdfaExtension:schemas>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:pdfaid=\"http://www.aiim.org/pdfa/ns/id/\">\n" +
" <pdfaid:part>3</pdfaid:part>\n" +
" <pdfaid:conformance>B</pdfaid:conformance>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\">\n" +
" <xmp:CreateDate>2014-07-11T13:39:46+02:00</xmp:CreateDate>\n" +
" <xmp:ModifyDate>2014-07-11T13:39:46+02:00</xmp:ModifyDate>\n" +
" <xmp:CreatorTool>zugferd_invoice.java</xmp:CreatorTool>\n" +
" <xmp:MetadataDate>2014-07-11T13:39:46+02:00</xmp:MetadataDate>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\">\n" +
" <pdf:Producer>PDFlib Personalization Server 9.0.3 (JDK 1.6/Mac OS X-10.6 64)</pdf:Producer>\n" +
" </rdf:Description>\n" +
" <rdf:Description rdf:about=\"\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n" +
" <dc:title>\n" +
" <rdf:Alt>\n" +
" <rdf:li xml:lang=\"x-default\">ZUGFeRD Rechnung $Revision: 1.13 $</rdf:li>\n" +
" </rdf:Alt>\n" +
" </dc:title>\n" +
" </rdf:Description>\n" +
" </rdf:RDF>\n" +
" </x:xmpmeta>\n" +
"<?xpacket end=\"r\"?>", zi.getXMP());
// this resembles the data written in MustangReaderWriterCustomXMLTest
assertEquals(amount, "1005.55");
}
public void testMigratePDFA1ToA3() throws IOException {
@@ -506,7 +504,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20171118_506blanko.pdf");
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().setZUGFeRDVersion(2).setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel.EN16931).load(SOURCE_PDF)) {
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().setZUGFeRDVersion(2).setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel.EN16931).load(SOURCE_PDF)) {
ze.PDFattachZugferdFile(this);
ze.disableAutoClose(true);
@@ -554,8 +552,8 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
}
/**
* @Test(expected = IndexOutOfBoundsException.class)
* @throws Exception
* @Test(expected = IndexOutOfBoundsException.class)
*/
public void testExceptionOnPDF14() throws Exception {
@@ -566,7 +564,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
try (InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505PDF14.pdf");
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().load(SOURCE_PDF)) {
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().load(SOURCE_PDF)) {
ze.PDFattachZugferdFile(this);
ze.export(TARGET_PDF);

View File

@@ -26,28 +26,35 @@ import java.util.logging.Level;
import java.util.logging.Logger;
/** This test utility class is providing usability functions for test file resources */
/**
* This test utility class is providing usability functions for test file resources
*/
public class ResourceUtilities {
private static final Logger LOG = Logger.getLogger(ResourceUtilities.class.getName());
private static final Logger LOG = Logger.getLogger(ResourceUtilities.class.getName());
/** Loading a File into a String using a certain encoding and file path */
public static String readFile(Charset encoding, String path) throws IOException {
byte[] content = Files.readAllBytes(Paths.get(path));
return new String(content, encoding);
}
/**
* Loading a File into a String using a certain encoding and file path
*/
public static String readFile(Charset encoding, String path) throws IOException {
byte[] content = Files.readAllBytes(Paths.get(path));
return new String(content, encoding);
}
/** Saving a String as a file to a certain file path */
public static void saveFile(Charset encoding, String path, String content) throws FileNotFoundException {
/**
* Saving a String as a file to a certain file path
*/
public static void saveFile(Charset encoding, String path, String content) throws FileNotFoundException {
// resources will be released automatically
try (PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(new File(path)), encoding), true)) {
out.println(content);
}
}
// resources will be released automatically
try (PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(new File(path)), encoding), true)) {
out.println(content);
}
}
/** The relative path of the test file will be resolved and the absolute will be returned
/**
* The relative path of the test file will be resolved and the absolute will be returned
*
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
* @return the absolute path of the test file
* @throws FileNotFoundException If the file could not be found
@@ -66,7 +73,9 @@ public class ResourceUtilities {
return uri.getPath();
}
/** The relative path of the test file will be resolved and the absolute will be returned
/**
* The relative path of the test file will be resolved and the absolute will be returned
*
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
* @return the URI created based on the relativeFilePath
* @throws URISyntaxException if no URI could be created from the given relative path
@@ -77,19 +86,23 @@ public class ResourceUtilities {
return new URI(filePath);
}
/** The relative path of the test file will be used to determine an absolute
* path to a temporary directory in the output directory.
/**
* The relative path of the test file will be used to determine an absolute
* path to a temporary directory in the output directory.
*
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
* @return absolute path to a test output
* @throws IOException if no absolute Path could be created.
*/
public static String getTestOutput(String relativeFilePath) throws IOException {
File tempFile=File.createTempFile(relativeFilePath, null);
File tempFile = File.createTempFile(relativeFilePath, null);
tempFile.deleteOnExit();
return tempFile.getAbsolutePath();
}
/** The Input of the test file will be resolved and the absolute will be returned
/**
* The Input of the test file will be resolved and the absolute will be returned
*
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
* @return the absolute path of the test file
*/
@@ -97,7 +110,9 @@ public class ResourceUtilities {
return ResourceUtilities.class.getClassLoader().getResourceAsStream(relativeFilePath);
}
/** Relative to the test output directory a test file will be returned dependent on the relativeFilePath provided.
/**
* Relative to the test output directory a test file will be returned dependent on the relativeFilePath provided.
*
* @param relativeFilePath Path of the test output resource relative to <code>target/test-classes/</code>.
* @return the empty <code>File</code> of the test output (to be filled)
*/
@@ -127,17 +142,17 @@ public class ResourceUtilities {
public static File getTempTestDirectory() {
File tempDir = new File(ResourceUtilities.getTestOutputFolder() + "temp");
tempDir.mkdir(); //if it already exist no problem
return tempDir;
return tempDir;
}
/**
/**
* To fix the 3 slashes bug for File URI: For example:
* file:/C:/work/test.txt -> file:///C:/work/test.txt
*
* @param u - the File URI
* @return the String of the URI
*/
public static String toExternalForm(URI u) {
public static String toExternalForm(URI u) {
StringBuilder sb = new StringBuilder();
if (u.getScheme() != null) {
sb.append(u.getScheme());
@@ -180,13 +195,14 @@ public class ResourceUtilities {
sb.append(u.getFragment());
}
String ret = null;
try {
ret = new URI(sb.toString()).toASCIIString();
} catch (URISyntaxException ex) {
LOG.log(Level.SEVERE, null, ex);
}
try {
ret = new URI(sb.toString()).toASCIIString();
} catch (URISyntaxException ex) {
LOG.log(Level.SEVERE, null, ex);
}
return ret;
}
private ResourceUtilities() {
}
private ResourceUtilities() {
}
}

View File

@@ -38,18 +38,18 @@ import java.util.logging.Logger;
* will be migrated to <code>src/test/resources/migration/output</code>.
* If there is a similar named file as test reference <code>src/test/resources/migration/reference</code> a test
* will be triggered for every single file.
*
* <p/>
* Note: Any 'ZUGFeRD1' will be exchanged to 'ZUGFeRD2' during migration and adequate reference will be searched for.
*/
@RunWith(Parameterized.class)
public class VersionMigrationTest {
private static final Logger LOG = Logger.getLogger(VersionMigrationTest.class.getName());
private static final Logger LOG = Logger.getLogger(VersionMigrationTest.class.getName());
private static final String INPUT_DIR = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "migration" + File.separator + "input" + File.separator;
private static final String REFERENCE_DIR = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "migration" + File.separator + "reference" + File.separator;
private static final String OUTPUT_DIR = "target" + File.separator + "test-classes" + File.separator + "migration" + File.separator + "output" + File.separator;
private File mTestFile = null;
private static final String INPUT_DIR = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "migration" + File.separator + "input" + File.separator;
private static final String REFERENCE_DIR = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "migration" + File.separator + "reference" + File.separator;
private static final String OUTPUT_DIR = "target" + File.separator + "test-classes" + File.separator + "migration" + File.separator + "output" + File.separator;
private File mTestFile = null;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
@@ -70,76 +70,75 @@ public class VersionMigrationTest {
private static void addFilesFromFolder(final File folder, Collection<Object[]> testSuiteData) {
String filePath = null;
for (final File fileEntry : folder.listFiles()) {
for (final File fileEntry : folder.listFiles()) {
filePath = fileEntry.getAbsolutePath();
if (fileEntry.isDirectory()) {
if (fileEntry.isDirectory()) {
LOG.log(Level.INFO, "*** testDirectory:{0}", filePath);
addFilesFromFolder(fileEntry, testSuiteData);
} else {
LOG.log(Level.INFO, "*** testFile: {0}", filePath);
Object[] testData = new Object[]{fileEntry};
testSuiteData.add(testData);
LOG.log(Level.INFO, "*** testFile: {0}", filePath);
Object[] testData = new Object[]{fileEntry};
testSuiteData.add(testData);
}
}
}
@Test
/**
* ZUGFeRD 1.0 to 2.0 migration test.
* For more information see class description. */
/**
* ZUGFeRD 1.0 to 2.0 migration test.
* For more information see class description. */
public void testFile() {
testMigration(mTestFile.getName());
testMigration(mTestFile.getName());
}
private void testMigration(String fileName) {
try {
String tmp = new ZUGFeRDMigrator().migrateFromV1ToV2(INPUT_DIR + fileName);
String newName = fileName.replace("ZUGFeRD1", "ZUGFeRD2");
ResourceUtilities.saveFile(StandardCharsets.UTF_8, OUTPUT_DIR + newName, tmp);
if(new File(REFERENCE_DIR + newName).exists()){
// we need to save the string and reload it otherwise two bytes are missing (likely EOF related)
String outXML = ResourceUtilities.readFile(StandardCharsets.UTF_8, OUTPUT_DIR + newName);
String refXML = ResourceUtilities.readFile(StandardCharsets.UTF_8, REFERENCE_DIR + newName);
int t = outXML.length();
int r = refXML.length();
if (t != r || !(outXML.equals(refXML))) {
LOG.info("There are differences between:"
+ "\nZUGFeRD 2.0 Test Output @ " + OUTPUT_DIR + newName
+ "\nZUGFeRD 2.0 Test Reference @ " + REFERENCE_DIR + newName);
LOG.info("\n\nFile sizes:\n "
+ "\nZUGFeRD 2.0 Test Output character count: " + t
+ "\nZUGFeRD 2.0 Test Refer. character count: " + r);
findLineDiffs(outXML, refXML);
Assert.fail("Version update failed, as test result and reference are different!");
}else{
LOG.log(Level.INFO,"\n*** Tested successfull migration from ZUGFeRD 1.0 to 2.0: '" + newName + "'' ***\n", OUTPUT_DIR);
}
}else{
LOG.log(Level.INFO,"\n*** Migrated from ZUGFeRD 1.0 to 2.0 invoice: '" + newName + "'' ***\n", OUTPUT_DIR);
}
} catch (IOException | TransformerException t) {
LOG.log(Level.SEVERE, t.getMessage(), t);
Assert.fail("Failed with " + t.getClass().getName() + ": '" + t.getMessage() + "'");
}
}
private void testMigration(String fileName) {
try {
String tmp = new ZUGFeRDMigrator().migrateFromV1ToV2(INPUT_DIR + fileName);
String newName = fileName.replace("ZUGFeRD1", "ZUGFeRD2");
ResourceUtilities.saveFile(StandardCharsets.UTF_8, OUTPUT_DIR + newName, tmp);
if (new File(REFERENCE_DIR + newName).exists()) {
// we need to save the string and reload it otherwise two bytes are missing (likely EOF related)
String outXML = ResourceUtilities.readFile(StandardCharsets.UTF_8, OUTPUT_DIR + newName);
String refXML = ResourceUtilities.readFile(StandardCharsets.UTF_8, REFERENCE_DIR + newName);
int t = outXML.length();
int r = refXML.length();
if (t != r || !(outXML.equals(refXML))) {
LOG.info("There are differences between:"
+ "\nZUGFeRD 2.0 Test Output @ " + OUTPUT_DIR + newName
+ "\nZUGFeRD 2.0 Test Reference @ " + REFERENCE_DIR + newName);
LOG.info("\n\nFile sizes:\n "
+ "\nZUGFeRD 2.0 Test Output character count: " + t
+ "\nZUGFeRD 2.0 Test Refer. character count: " + r);
findLineDiffs(outXML, refXML);
Assert.fail("Version update failed, as test result and reference are different!");
} else {
LOG.log(Level.INFO, "\n*** Tested successfull migration from ZUGFeRD 1.0 to 2.0: '" + newName + "'' ***\n", OUTPUT_DIR);
}
} else {
LOG.log(Level.INFO, "\n*** Migrated from ZUGFeRD 1.0 to 2.0 invoice: '" + newName + "'' ***\n", OUTPUT_DIR);
}
} catch (IOException | TransformerException t) {
LOG.log(Level.SEVERE, t.getMessage(), t);
Assert.fail("Failed with " + t.getClass().getName() + ": '" + t.getMessage() + "'");
}
}
private static void findLineDiffs(String outXML, String refXML){
Scanner outScanner = new Scanner(outXML);
Scanner refScanner = new Scanner(refXML);
String outLine = null;
String refLine = null;
while (outScanner.hasNextLine() && refScanner.hasNextLine()) {
outLine = outScanner.nextLine();
refLine = refScanner.nextLine();
if(!outLine.equals(refLine)){
LOG.info("First line difference between reference and output file:" +
"\nRefLine: " + refLine +
"\nOutLine: " + outLine + "\n");
}
}
refScanner.close();
outScanner.close();
}
private static void findLineDiffs(String outXML, String refXML) {
Scanner outScanner = new Scanner(outXML);
Scanner refScanner = new Scanner(refXML);
String outLine = null;
String refLine = null;
while (outScanner.hasNextLine() && refScanner.hasNextLine()) {
outLine = outScanner.nextLine();
refLine = refScanner.nextLine();
if (!outLine.equals(refLine)) {
LOG.info("First line difference between reference and output file:" +
"\nRefLine: " + refLine +
"\nOutLine: " + outLine + "\n");
}
}
refScanner.close();
outScanner.close();
}
}

View File

@@ -27,48 +27,48 @@ import java.util.Date;
import java.util.GregorianCalendar;
public class ZUGFeRDTransactionModelConverterTest {
@Test
public void convertToModel_convertsMinimalTransactionToValidXml() throws Exception {
// setup
IZUGFeRDExportableTransaction transaction = new IZUGFeRDExportableTransactionImpl()
.setIssueDate(createDate(2000, 1, 1))
.setDeliveryDate(createDate(2000, 1, 2))
.setDueDate(createDate(2000, 1, 3))
.setNumber("num")
.setRecipient(new IZUGFeRDExportableContactImpl()
.setName("recipient name")
.setStreet("recipient street")
.setLocation("recipient city")
.setCountry("recipient country")
)
.setOwnOrganisationName("own org")
.setOwnStreet("own street")
.setOwnCountry("own country")
.setOwnLocation("own city")
.setOwnBankName("own bank")
.setZFItems(
new IZUGFeRDExportableItemImpl()
.setProduct(new IZUGFeRDExportableProductImpl()
.setVatPercent(new BigDecimal("1.19"))
.setName("product name")
.setDescription("product description")
.setUnit("product unit")
)
.setQuantity(BigDecimal.ONE)
.setPrice(BigDecimal.TEN)
);
@Test
public void convertToModel_convertsMinimalTransactionToValidXml() throws Exception {
// setup
IZUGFeRDExportableTransaction transaction = new IZUGFeRDExportableTransactionImpl()
.setIssueDate(createDate(2000, 1, 1))
.setDeliveryDate(createDate(2000, 1, 2))
.setDueDate(createDate(2000, 1, 3))
.setNumber("num")
.setRecipient(new IZUGFeRDExportableContactImpl()
.setName("recipient name")
.setStreet("recipient street")
.setLocation("recipient city")
.setCountry("recipient country")
)
.setOwnOrganisationName("own org")
.setOwnStreet("own street")
.setOwnCountry("own country")
.setOwnLocation("own city")
.setOwnBankName("own bank")
.setZFItems(
new IZUGFeRDExportableItemImpl()
.setProduct(new IZUGFeRDExportableProductImpl()
.setVatPercent(new BigDecimal("1.19"))
.setName("product name")
.setDescription("product description")
.setUnit("product unit")
)
.setQuantity(BigDecimal.ONE)
.setPrice(BigDecimal.TEN)
);
// execution
final JAXBElement<CrossIndustryDocumentType> actual =
new ZUGFeRDTransactionModelConverter(transaction).convertToModel();
// execution
final JAXBElement<CrossIndustryDocumentType> actual =
new ZUGFeRDTransactionModelConverter(transaction).convertToModel();
// evaluation
ZUGFeRDXMLAssert.assertValidZugferd(actual);
}
// evaluation
ZUGFeRDXMLAssert.assertValidZugferd(actual);
}
private static Date createDate(int year, int month, int day) {
final GregorianCalendar calendar = new GregorianCalendar();
calendar.set(year, month-1, day);
return calendar.getTime();
}
private static Date createDate(int year, int month, int day) {
final GregorianCalendar calendar = new GregorianCalendar();
calendar.set(year, month - 1, day);
return calendar.getTime();
}
}

View File

@@ -30,27 +30,27 @@ import javax.xml.bind.JAXBElement;
import javax.xml.parsers.DocumentBuilderFactory;
public class ZUGFeRDXMLAssert {
private static final ISchematronResource SCHEMATRON = loadSchematron();
private static final ISchematronResource SCHEMATRON = loadSchematron();
public static void assertValidZugferd(JAXBElement<CrossIndustryDocumentType> xml) throws Exception {
assertValidZugferd(toDocument(xml));
}
public static void assertValidZugferd(JAXBElement<CrossIndustryDocumentType> xml) throws Exception {
assertValidZugferd(toDocument(xml));
}
public static void assertValidZugferd(Node xml) throws Exception {
Assert.assertTrue("schema valid", SCHEMATRON.getSchematronValidity(xml, null).isValid());
}
public static void assertValidZugferd(Node xml) throws Exception {
Assert.assertTrue("schema valid", SCHEMATRON.getSchematronValidity(xml, null).isValid());
}
private static Document toDocument(Object jaxbElement) throws Exception {
final Document result = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
JAXBContext.newInstance("org.mustangproject.ZUGFeRD.model").createMarshaller().marshal(jaxbElement, result);
return result;
}
private static Document toDocument(Object jaxbElement) throws Exception {
final Document result = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
JAXBContext.newInstance("org.mustangproject.ZUGFeRD.model").createMarshaller().marshal(jaxbElement, result);
return result;
}
private static SchematronResourcePure loadSchematron() {
final SchematronResourcePure result = SchematronResourcePure.fromClassPath("/ZUGFeRD_1p0.scmt");
if (!result.isValidSchematron ()) {
throw new IllegalArgumentException("Invalid Schematron!");
}
return result;
}
private static SchematronResourcePure loadSchematron() {
final SchematronResourcePure result = SchematronResourcePure.fromClassPath("/ZUGFeRD_1p0.scmt");
if (!result.isValidSchematron()) {
throw new IllegalArgumentException("Invalid Schematron!");
}
return result;
}
}