- * Copyright 2019 Jochen Staerk - *
- * Use is subject to license terms. - *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0. - *
- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - *
- * See the License for the specific language governing permissions and - * limitations under the License. - *
- * ********************************************************************** - */ -package org.mustangproject.ZUGFeRD; - -import org.junit.FixMethodOrder; -import org.junit.runners.MethodSorters; -import org.mustangproject.ZUGFeRD.ZUGFeRDVisualizer.Language; -import org.mustangproject.util.ByteArraySearcher; - -import javax.xml.transform.TransformerException; -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; - -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class VisualizationTest extends ResourceCase { - - final String TARGET_PDF_CII = "./target/testout-Visualization-cii.pdf"; - final String TARGET_PDF_UBL = "./target/testout-Visualization-cii.pdf"; - - public void testCIIVisualizationBasic() { - this.runZUGFeRDVisualization("factur-x.xml", "factur-x-vis.fr.html", Language.FR); - } - - public void testCIIVisualizationExtended() { - this.runZUGFeRDVisualization("factur-x-extended.xml", "factur-x-vis-extended.de.html", Language.DE); - } - - public void testUBLCreditNoteVisualizationBasic() { - this.runZUGFeRDVisualization("ubl-creditnote.xml", "factur-x-vis-ubl-creditnote.en.html", Language.EN); - } - - public void testUBLVisualizationBasic() { - this.runZUGFeRDVisualization("ubl/01.01a-INVOICE.ubl.xml", "factur-x-vis-ubl.en.html", Language.EN); - } - - private void runZUGFeRDVisualization(String inputFilename, String resultFileName, Language lang) { - File CIIinputFile = getResourceAsFile(inputFilename); - - String expected = null; - String result = null; - try { - ZUGFeRDVisualizer zvi = new ZUGFeRDVisualizer(); - result = zvi.visualize(CIIinputFile.getAbsolutePath(), lang); - - File expectedResult = getResourceAsFile(resultFileName); - expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8); - - } catch (UnsupportedOperationException e) { - fail("UnsupportedOperationException should not happen: " + e.getMessage()); - } catch (IllegalArgumentException e) { - fail("IllegalArgumentException should not happen: " + e.getMessage()); - } catch (TransformerException e) { - fail("TransformerException should not happen: " + e.getMessage()); - } catch (IOException e) { - fail("IOException should not happen: " + e.getMessage()); - } - - - assertNotNull(result); - /* remove file endings so that tests can also pass after checking - out from git with arbitrary options (which may include CSRF changes) - */ - assertEquals(expected.replace("\r", "") - .replace("\n", "") - .replace("\t", "") - .replace(" ", ""), result.replace("\r", "") - .replace("\n", "") - .replace("\t", "") - .replace(" ", "")); - } - - public void testPDFVisualizationCII() { - - File CIIinputFile = getResourceAsFile("cii/01.01a-INVOICE.cii.xml"); - - // the writing part - - String expected = null; - String result = null; - try { - ZUGFeRDVisualizer zvi = new ZUGFeRDVisualizer(); - zvi.toPDF(CIIinputFile.getAbsolutePath(), TARGET_PDF_CII); - } catch (UnsupportedOperationException e) { - fail("UnsupportedOperationException should not happen: " + e.getMessage()); - } catch (IllegalArgumentException e) { - fail("IllegalArgumentException should not happen: " + e.getMessage()); - } - - try { - assertTrue(ByteArraySearcher.startsWith(Files.readAllBytes(Paths.get(TARGET_PDF_CII)), new byte[]{'%', 'P', 'D', 'F'})); - } catch (IOException e) { - fail("IOException should not occur"); - } - } - - public void testPDFVisualizationUBL() { - - File UBLinputFile = getResourceAsFile("ubl/01.01a-INVOICE.ubl.xml"); - - // the writing part - String sourceFilename = "factur-x.xml"; - - String expected = null; - String result = null; - try { - ZUGFeRDVisualizer zvi = new ZUGFeRDVisualizer(); - zvi.toPDF(UBLinputFile.getAbsolutePath(), TARGET_PDF_UBL); - } catch (UnsupportedOperationException e) { - fail("UnsupportedOperationException should not happen: " + e.getMessage()); - } catch (IllegalArgumentException e) { - fail("IllegalArgumentException should not happen: " + e.getMessage()); - } - - - try { - assertTrue(ByteArraySearcher.startsWith(Files.readAllBytes(Paths.get(TARGET_PDF_CII)), new byte[]{'%', 'P', 'D', 'F'})); - } catch (IOException e) { - fail("IOException should not occur"); - } - } - - public void testPDFVisualizationUBLCreditNote() { - - File UBLinputFile = getResourceAsFile("ubl/UBL-CreditNote-2.1-Example.ubl.xml"); - - // the writing part - String sourceFilename = "factur-x.xml"; - - String expected = null; - String result = null; - try { - ZUGFeRDVisualizer zvi = new ZUGFeRDVisualizer(); - zvi.toPDF(UBLinputFile.getAbsolutePath(), TARGET_PDF_UBL); - } catch (UnsupportedOperationException e) { - fail("UnsupportedOperationException should not happen: " + e.getMessage()); - } catch (IllegalArgumentException e) { - fail("IllegalArgumentException should not happen: " + e.getMessage()); - } - - - try { - assertTrue(ByteArraySearcher.startsWith(Files.readAllBytes(Paths.get(TARGET_PDF_CII)), new byte[]{'%', 'P', 'D', 'F'})); - } catch (IOException e) { - fail("IOException should not occur"); - } - } - -} +/** + * ********************************************************************* + *
+ * Copyright 2019 Jochen Staerk + *
+ * Use is subject to license terms. + *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0. + *
+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + *
+ * See the License for the specific language governing permissions and + * limitations under the License. + *
+ * ********************************************************************** + */ +package org.mustangproject.ZUGFeRD; + +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; +import org.mustangproject.ZUGFeRD.ZUGFeRDVisualizer.Language; +import org.mustangproject.util.ByteArraySearcher; + +import javax.xml.transform.TransformerException; +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class VisualizationTest extends ResourceCase { + + final String TARGET_PDF_CII = "./target/testout-Visualization-cii.pdf"; + final String TARGET_PDF_UBL = "./target/testout-Visualization-cii.pdf"; + + public void testCIIVisualizationBasic() { + this.runZUGFeRDVisualization("factur-x.xml", "factur-x-vis.fr.html", Language.FR); + } + + public void testCIIVisualizationExtended() { + this.runZUGFeRDVisualization("factur-x-extended.xml", "factur-x-vis-extended.de.html", Language.DE); + } + + public void testUBLCreditNoteVisualizationBasic() { + this.runZUGFeRDVisualization("ubl-creditnote.xml", "factur-x-vis-ubl-creditnote.en.html", Language.EN); + } + + public void testUBLVisualizationBasic() { + this.runZUGFeRDVisualization("ubl/01.01a-INVOICE.ubl.xml", "factur-x-vis-ubl.en.html", Language.EN); + } + + private void runZUGFeRDVisualization(String inputFilename, String resultFileName, Language lang) { + File CIIinputFile = getResourceAsFile(inputFilename); + + String expected = null; + String result = null; + try { + ZUGFeRDVisualizer zvi = new ZUGFeRDVisualizer(); + result = zvi.visualize(CIIinputFile.getAbsolutePath(), lang); + Files.write(Paths.get("./target/testout-" + resultFileName), result.getBytes(StandardCharsets.UTF_8)); + + File expectedResult = getResourceAsFile(resultFileName); + expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8) + ; + + } catch (UnsupportedOperationException e) { + fail("UnsupportedOperationException should not happen: " + e.getMessage()); + } catch (IllegalArgumentException e) { + fail("IllegalArgumentException should not happen: " + e.getMessage()); + } catch (TransformerException e) { + fail("TransformerException should not happen: " + e.getMessage()); + } catch (IOException e) { + fail("IOException should not happen: " + e.getMessage()); + } + + + assertNotNull(result); + /* remove file endings so that tests can also pass after checking + out from git with arbitrary options (which may include CSRF changes) + */ + assertEquals(expected.replace("\r", "") + .replace("\n", "") + .replace("\t", "") + .replace(" ", ""), result.replace("\r", "") + .replace("\n", "") + .replace("\t", "") + .replace(" ", "")); + } + + public void testPDFVisualizationCII() { + + File CIIinputFile = getResourceAsFile("cii/01.01a-INVOICE.cii.xml"); + + // the writing part + + String expected = null; + String result = null; + try { + ZUGFeRDVisualizer zvi = new ZUGFeRDVisualizer(); + zvi.toPDF(CIIinputFile.getAbsolutePath(), TARGET_PDF_CII); + } catch (UnsupportedOperationException e) { + fail("UnsupportedOperationException should not happen: " + e.getMessage()); + } catch (IllegalArgumentException e) { + fail("IllegalArgumentException should not happen: " + e.getMessage()); + } + + try { + assertTrue(ByteArraySearcher.startsWith(Files.readAllBytes(Paths.get(TARGET_PDF_CII)), new byte[]{'%', 'P', 'D', 'F'})); + } catch (IOException e) { + fail("IOException should not occur"); + } + } + + public void testPDFVisualizationUBL() { + + File UBLinputFile = getResourceAsFile("ubl/01.01a-INVOICE.ubl.xml"); + + // the writing part + String sourceFilename = "factur-x.xml"; + + String expected = null; + String result = null; + try { + ZUGFeRDVisualizer zvi = new ZUGFeRDVisualizer(); + zvi.toPDF(UBLinputFile.getAbsolutePath(), TARGET_PDF_UBL); + } catch (UnsupportedOperationException e) { + fail("UnsupportedOperationException should not happen: " + e.getMessage()); + } catch (IllegalArgumentException e) { + fail("IllegalArgumentException should not happen: " + e.getMessage()); + } + + + try { + assertTrue(ByteArraySearcher.startsWith(Files.readAllBytes(Paths.get(TARGET_PDF_CII)), new byte[]{'%', 'P', 'D', 'F'})); + } catch (IOException e) { + fail("IOException should not occur"); + } + } + + public void testPDFVisualizationUBLCreditNote() { + + File UBLinputFile = getResourceAsFile("ubl/UBL-CreditNote-2.1-Example.ubl.xml"); + + // the writing part + String sourceFilename = "factur-x.xml"; + + String expected = null; + String result = null; + try { + ZUGFeRDVisualizer zvi = new ZUGFeRDVisualizer(); + zvi.toPDF(UBLinputFile.getAbsolutePath(), TARGET_PDF_UBL); + } catch (UnsupportedOperationException e) { + fail("UnsupportedOperationException should not happen: " + e.getMessage()); + } catch (IllegalArgumentException e) { + fail("IllegalArgumentException should not happen: " + e.getMessage()); + } + + + try { + assertTrue(ByteArraySearcher.startsWith(Files.readAllBytes(Paths.get(TARGET_PDF_CII)), new byte[]{'%', 'P', 'D', 'F'})); + } catch (IOException e) { + fail("IOException should not occur"); + } + } + +} diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java index ce0ee767..48daa626 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2PushTest.java @@ -1,826 +1,828 @@ - -/** - * ********************************************************************* - *
- * Copyright 2019 Jochen Staerk - *
- * Use is subject to license terms. - *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0. - *
- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - *
- * See the License for the specific language governing permissions and - * limitations under the License. - *
- * **********************************************************************
- */
-package org.mustangproject.ZUGFeRD;
-
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.nio.charset.StandardCharsets;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-import org.mustangproject.*;
-import org.junit.FixMethodOrder;
-import org.junit.runners.MethodSorters;
-
-import junit.framework.TestCase;
-
-import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
-import org.mustangproject.ZUGFeRD.model.EventTimeCodeTypeConstants;
-
-import javax.xml.xpath.XPathExpressionException;
-
-import static org.xmlunit.assertj.XmlAssert.assertThat;
-
-
-@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class ZF2PushTest extends TestCase {
- final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20201121_508.pdf";
- final String TARGET_ALLOWANCESPDF = "./target/testout-ZF2PushAllowances.pdf";
- final String TARGET_CREDITNOTEPDF = "./target/testout-ZF2PushCreditNote.pdf";
- final String TARGET_CORRECTIONPDF = "./target/testout-ZF2PushCorrection.pdf";
- final String TARGET_ITEMCHARGESALLOWANCESPDF = "./target/testout-ZF2PushItemChargesAllowances.pdf";
- final String TARGET_CHARGESALLOWANCESPDF = "./target/testout-ZF2PushChargesAllowances.pdf";
- final String TARGET_RELATIVECHARGESALLOWANCESPDF = "./target/testout-ZF2PushRelativeChargesAllowances.pdf";
- final String TARGET_ATTACHMENTSPDF = "./target/testout-ZF2PushAttachments.pdf";
- final String TARGET_BANKPDF = "./target/testout-ZF2PushBank.pdf";
- final String TARGET_PUSHEDGE = "./target/testout-ZF2PushEdge.pdf";
- final String TARGET_INTRACOMMUNITYSUPPLYMANUALPDF = "./target/testout-ZF2PushIntraCommunitySupplyManual.pdf";
- final String TARGET_INTRACOMMUNITYSUPPLYPDF = "./target/testout-ZF2PushIntraCommunitySupply.pdf";
- final String TARGET_REVERSECHARGEPDF = "./target/testout-ZF2PushReverseCharge.pdf";
-
- public void testPushExport() {
- /***
- * This writes to a filename like an official sample, please consider when changing (probably better not?)
- */
- // the writing part
- String orgname = "Bei Spiel GmbH";
- String number = "RE-20201121/508";
- String priceStr = "160.00";
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-
- BigDecimal price = new BigDecimal(priceStr);
- try {
- InputStream SOURCE_PDF = this.getClass()
- .getResourceAsStream("/MustangGnuaccountingBeispielRE-20201121_508blanko.pdf");
-
- ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
- ze.ignorePDFAErrors();
- ze.load(SOURCE_PDF);
- ze.setProducer("My Application").setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2);
- ze.setTransaction(new Invoice().setDueDate(sdf.parse("2020-12-12")).setIssueDate(sdf.parse("2020-11-21")).setDeliveryDate(sdf.parse("2020-11-10"))
- .setSender(new TradeParty(orgname, "Ecke 12", "12345", "Stadthausen", "DE").addBankDetails(new BankDetails("DE88200800000970375700", "COBADEFFXXX").setAccountName("Max Mustermann")).addVATID("DE136695976"))
- .setRecipient(new TradeParty("Theodor Est", "Bahnstr. 42", "88802", "Spielkreis", "DE")
- .setContact(new Contact("Ingmar N. Fo", "(555) 23 78-23", "info@localhost.local")).setID("2"))
- .setNumber(number)
- .setReferenceNumber("AB321")
- .addItem(new Item(new Product("Design (hours)", "Of a sample invoice", "HUR", new BigDecimal(7)), price, new BigDecimal(1.0)))
- .addItem(new Item(new Product("Ballons", "various colors, ~2000ml", "H87", new BigDecimal(19)), new BigDecimal("0.79"), new BigDecimal(400.0)))
- .addItem(new Item(new Product("Hot air „heiße Luft“ (litres)", "", "LTR", new BigDecimal(19)), new BigDecimal("0.025"), new BigDecimal(800.0)))
- .setRoundingAmount(new BigDecimal("1"))
- );
-
- ze.export(TARGET_PDF);
- } catch (IOException | ParseException e) {
- fail("Exception should not be raised");
- }
-
- ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(TARGET_PDF);
- Invoice i = new Invoice();
- try {
- zii.extractInto(i);
- } catch (XPathExpressionException e) {
- throw new RuntimeException(e);
- } catch (ParseException e) {
- throw new RuntimeException(e);
- }
-
-
- // now check the contents (like MustangReaderTest)
- ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
- assertTrue(zi.getUTF8().contains("DE88200800000970375700")); //the iban
- assertTrue(zi.getUTF8().contains("Max Mustermann")); //account holder
- assertTrue(zi.getUTF8().contains("DueDateDateTime")); //account holder
- assertTrue(zi.getUTF8().contains("20201212")); //account holder
-
- assertTrue(zi.getUTF8().contains("
+ * Use is subject to license terms.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * **********************************************************************
+ */
+package org.mustangproject.ZUGFeRD;
+
+import java.io.ByteArrayInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.mustangproject.*;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+import junit.framework.TestCase;
+
+import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
+import org.mustangproject.ZUGFeRD.model.EventTimeCodeTypeConstants;
+
+import javax.xml.xpath.XPathExpressionException;
+
+import static org.xmlunit.assertj.XmlAssert.assertThat;
+
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ZF2PushTest extends TestCase {
+ final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20201121_508.pdf";
+ final String TARGET_ALLOWANCESPDF = "./target/testout-ZF2PushAllowances.pdf";
+ final String TARGET_CREDITNOTEPDF = "./target/testout-ZF2PushCreditNote.pdf";
+ final String TARGET_CORRECTIONPDF = "./target/testout-ZF2PushCorrection.pdf";
+ final String TARGET_ITEMCHARGESALLOWANCESPDF = "./target/testout-ZF2PushItemChargesAllowances.pdf";
+ final String TARGET_CHARGESALLOWANCESPDF = "./target/testout-ZF2PushChargesAllowances.pdf";
+ final String TARGET_RELATIVECHARGESALLOWANCESPDF = "./target/testout-ZF2PushRelativeChargesAllowances.pdf";
+ final String TARGET_ATTACHMENTSPDF = "./target/testout-ZF2PushAttachments.pdf";
+ final String TARGET_BANKPDF = "./target/testout-ZF2PushBank.pdf";
+ final String TARGET_PUSHEDGE = "./target/testout-ZF2PushEdge.pdf";
+ final String TARGET_INTRACOMMUNITYSUPPLYMANUALPDF = "./target/testout-ZF2PushIntraCommunitySupplyManual.pdf";
+ final String TARGET_INTRACOMMUNITYSUPPLYPDF = "./target/testout-ZF2PushIntraCommunitySupply.pdf";
+ final String TARGET_REVERSECHARGEPDF = "./target/testout-ZF2PushReverseCharge.pdf";
+
+ public void testPushExport() {
+ /***
+ * This writes to a filename like an official sample, please consider when changing (probably better not?)
+ */
+ // the writing part
+ String orgname = "Bei Spiel GmbH";
+ String number = "RE-20201121/508";
+ String priceStr = "160.00";
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+
+ BigDecimal price = new BigDecimal(priceStr);
+ try {
+ InputStream SOURCE_PDF = this.getClass()
+ .getResourceAsStream("/MustangGnuaccountingBeispielRE-20201121_508blanko.pdf");
+
+ ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1();
+ ze.ignorePDFAErrors();
+ ze.load(SOURCE_PDF);
+ ze.setProducer("My Application").setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2);
+ ze.setTransaction(new Invoice().setDueDate(sdf.parse("2020-12-12")).setIssueDate(sdf.parse("2020-11-21")).setDeliveryDate(sdf.parse("2020-11-10"))
+ .setSender(new TradeParty(orgname, "Ecke 12", "12345", "Stadthausen", "DE").addBankDetails(new BankDetails("DE88200800000970375700", "COBADEFFXXX").setAccountName("Max Mustermann")).addVATID("DE136695976"))
+ .setRecipient(new TradeParty("Theodor Est", "Bahnstr. 42", "88802", "Spielkreis", "DE")
+ .setContact(new Contact("Ingmar N. Fo", "(555) 23 78-23", "info@localhost.local")).setID("2"))
+ .setNumber(number)
+ .setReferenceNumber("AB321")
+ .addItem(new Item(new Product("Design (hours)", "Of a sample invoice", "HUR", new BigDecimal(7)), price, new BigDecimal(1.0)))
+ .addItem(new Item(new Product("Ballons", "various colors, ~2000ml", "H87", new BigDecimal(19)), new BigDecimal("0.79"), new BigDecimal(400.0)))
+ .addItem(new Item(new Product("Hot air „heiße Luft“ (litres)", "", "LTR", new BigDecimal(19)), new BigDecimal("0.025"), new BigDecimal(800.0)))
+ .setRoundingAmount(new BigDecimal("1"))
+ );
+
+ ze.export(TARGET_PDF);
+ } catch (IOException | ParseException e) {
+ fail("Exception should not be raised");
+ }
+
+ ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(TARGET_PDF);
+ Invoice i = new Invoice();
+ try {
+ zii.extractInto(i);
+ } catch (XPathExpressionException e) {
+ throw new RuntimeException(e);
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+
+
+ // now check the contents (like MustangReaderTest)
+ ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
+ assertTrue(zi.getUTF8().contains("DE88200800000970375700")); //the iban
+ assertTrue(zi.getUTF8().contains("Max Mustermann")); //account holder
+ assertTrue(zi.getUTF8().contains("DueDateDateTime")); //account holder
+ assertTrue(zi.getUTF8().contains("20201212")); //account holder
+
+ assertTrue(zi.getUTF8().contains("