diff --git a/library/pom.xml b/library/pom.xml index 882eb324..9aaed089 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -102,7 +102,7 @@ com.helger en16931-cii2ubl - 1.3.0 + 1.4.2 diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/UBLTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/UBLTest.java index 38614e44..13906407 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/UBLTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/UBLTest.java @@ -24,22 +24,31 @@ package org.mustangproject.ZUGFeRD; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; -import java.io.InputStream; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Date; -import org.junit.FixMethodOrder; -import org.junit.runners.MethodSorters; -import org.mustangproject.*; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.mustangproject.BankDetails; import org.mustangproject.CII.CIIToUBL; +import org.mustangproject.Contact; +import org.mustangproject.Invoice; +import org.mustangproject.Item; +import org.mustangproject.Product; +import org.mustangproject.TradeParty; -@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class UBLTest extends ResourceCase { final String TARGET_XML = "./target/testout-1Lieferschein.xml"; + public UBLTest() { + } + + @Test + @Order(2) public void testUBLBasic() { // the writing part @@ -52,21 +61,23 @@ public class UBLTest extends ResourceCase { try { final File tempFile = File.createTempFile("ZUGFeRD-UBL-", "-test"); c2u.convert(input, tempFile); - expected = ResourceUtilities.readFile(StandardCharsets.UTF_8, expectedFile.getAbsolutePath()).replaceAll("\r\n", "\n"); - result = ResourceUtilities.readFile(StandardCharsets.UTF_8, tempFile.getAbsolutePath()).replaceAll("\r\n", "\n"); + expected = ResourceUtilities.readFile(StandardCharsets.UTF_8, expectedFile.getAbsolutePath());//.replaceAll("\r\n", "\n"); + result = ResourceUtilities.readFile(StandardCharsets.UTF_8, tempFile.getAbsolutePath());//.replaceAll("\r\n", "\n"); } catch (final IOException e) { fail("Exception should not happen: " + e.getMessage()); } assertNotNull(result); - assertEquals(expected, result); + Assertions.assertThat(result).isXmlEqualTo(expected); } + @Test + @Order(1) public void test1Lieferschein() { - EinLieferscheinExporter oe = new EinLieferscheinExporter(); - Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()) + final EinLieferscheinExporter oe = new EinLieferscheinExporter(); + final Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()) .setSender(new TradeParty("Test company", "teststr", "55232", "teststadt", "DE").addTaxID("DE4711").addVATID("DE0815").setContact(new Contact("Hans Test", "+49123456789", "test@example.org")).addBankDetails(new BankDetails("DE12500105170648489890", "COBADEFXXX"))) .setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")) .setReferenceNumber("991-01484-64")//leitweg-id @@ -75,13 +86,13 @@ public class UBLTest extends ResourceCase { try { oe.setTransaction(i); - ByteArrayOutputStream baos=new ByteArrayOutputStream(); + final ByteArrayOutputStream baos=new ByteArrayOutputStream(); oe.export(baos); - String theXML = baos.toString("UTF-8"); + final String theXML = baos.toString("UTF-8"); assertTrue(theXML.contains(" - - urn:cen.eu:en16931:2017:extended:urn:fdc:peppol.eu:2017:poacc:billing:3.0 + + urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 RE-20201121/508 2020-11-21 @@ -13,21 +15,21 @@ Bei Spiel GmbH - + Ecke 12 - Stadthausen - 12345 - + Stadthausen + 12345 + DE - + DE136695976 - + VAT - + Bei Spiel GmbH @@ -37,18 +39,18 @@ 2 - + Theodor Est - + Bahnstr. 42 - Spielkreis - 88802 - + Spielkreis + 88802 + DE - + Theodor Est @@ -61,24 +63,24 @@ 75.04 - + 160.00 - 11.20 - + 11.20 + S - 7.00 - + 7.00 + VAT - + 336.00 - 63.84 - + 63.84 + S - 19.00 - + 19.00 + VAT @@ -86,71 +88,71 @@ 496.00 - 496.00 - 571.04 - 0.00 - 0.00 - 0.00 - 571.04 + 496.00 + 571.04 + 0.00 + 0.00 + 0.00 + 571.04 1 - 1.0000 - 160.00 - + 1.0000 + 160.00 + Of a sample invoice - Design (hours) - + Design (hours) + S - 7.00 - + 7.00 + VAT - + 160.0000 - 1.0000 + 1.0000 2 - 400.0000 - 316.00 - + 400.0000 + 316.00 + various colors, ~2000ml - Ballons - + Ballons + S - 19.00 - + 19.00 + VAT - + 0.7900 - 1.0000 + 1.0000 3 - 800.0000 - 20.00 - + 800.0000 + 20.00 + - Hot air „heiße Luft“ (litres) - + Hot air „heiße Luft“ (litres) + S - 19.00 - + 19.00 + VAT - + 0.0250 - 1.0000 + 1.0000 \ No newline at end of file