no message

This commit is contained in:
Jochen Stärk
2020-09-14 20:14:32 +02:00
parent b70e3571be
commit 48f6ae92ad
3 changed files with 25 additions and 7 deletions

View File

@@ -51,7 +51,6 @@ switch
- homepage to be updated accordingly - homepage to be updated accordingly
- confirm correct generation from pdf/a3 files zf2edgetest - confirm correct generation from pdf/a3 files zf2edgetest
- *correctiontest exports zf1+zf2? - *correctiontest exports zf1+zf2?
- *use validator in tests of library
- *USt 0% wird aus invoice-klasse noch nicht sauber abgefangen - *USt 0% wird aus invoice-klasse noch nicht sauber abgefangen
- new features additional docs, contract id, periods, corrected invoices, discounts, occurrence dates and periods - new features additional docs, contract id, periods, corrected invoices, discounts, occurrence dates and periods

View File

@@ -34,7 +34,8 @@ import junit.framework.TestCase;
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ZF2PushTest extends TestCase { public class ZF2PushTest extends TestCase {
final String TARGET_PDF = "./target/testout-ZF2Push.pdf"; final String TARGET_PDF = "./target/testout-ZF2Push.pdf";
final String TARGET_CORRECTIONPDF = "./target/testout-ZF2Correction.pdf"; final String TARGET_CORRECTIONPDF = "./target/testout-ZF2PushCorrection.pdf";
final String TARGET_CHARGESALLOWANCESPDF = "./target/testout-ZF2PushChargesAllowances.pdf";
public void testPushExport() { public void testPushExport() {
@@ -134,7 +135,7 @@ public class ZF2PushTest extends TestCase {
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors() .setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
.load(SOURCE_PDF)) { .load(SOURCE_PDF)) {
ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number) ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "","K"))) .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "","K")))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "","K"))) .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "","K")))
.addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "","K")).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "","K"))) .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance(new BigDecimal(0.07),new BigDecimal(0), "","K")).addCharge(new Charge(new BigDecimal(0.1),new BigDecimal(0), "","K")))
@@ -142,13 +143,13 @@ public class ZF2PushTest extends TestCase {
); );
String theXML = new String(ze.getProvider().getXML()); String theXML = new String(ze.getProvider().getXML());
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice")); assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
ze.export(TARGET_PDF); ze.export(TARGET_CHARGESALLOWANCESPDF);
} catch (IOException e) { } catch (IOException e) {
fail("IOException should not be raised in testEdgeExport"); fail("IOException should not be raised in testEdgeExport");
} }
// now check the contents (like MustangReaderTest) // now check the contents (like MustangReaderTest)
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF); ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_CHARGESALLOWANCESPDF);
assertTrue(zi.getUTF8().contains("EUR")); assertTrue(zi.getUTF8().contains("EUR"));

View File

@@ -27,7 +27,7 @@ public class LibraryTest extends ResourceCase {
assertThat(res).valueByXPath("/validation/summary/@status") assertThat(res).valueByXPath("/validation/summary/@status")
.isEqualTo("valid"); .isEqualTo("valid");
tempFile = new File("../library/target/testout-ZF2Correction.pdf"); tempFile = new File("../library/target/testout-ZF2PushCorrection.pdf");
assertTrue(tempFile.exists()); assertTrue(tempFile.exists());
res = zfv.validate(tempFile.getAbsolutePath()); res = zfv.validate(tempFile.getAbsolutePath());
@@ -44,7 +44,25 @@ public class LibraryTest extends ResourceCase {
} }
public void testLibraryPushCorrection() { public void testLibraryPushCorrection() {
File tempFile = new File("../library/target/testout-ZF2Correction.pdf"); File tempFile = new File("../library/target/testout-ZF2PushCorrection.pdf");
assertTrue(tempFile.exists());
ZUGFeRDValidator zfv = new ZUGFeRDValidator();
String res = zfv.validate(tempFile.getAbsolutePath());
assertThat(res).valueByXPath("/validation/pdf/summary/@status")
.isEqualTo("valid");
assertThat(res).valueByXPath("/validation/xml/summary/@status")
.isEqualTo("valid");
assertThat(res).valueByXPath("/validation/summary/@status")
.isEqualTo("valid");
}
public void testLibraryPushAllowances() {
File tempFile = new File("../library/target/testout-ZF2PushChargesAllowances.pdf");
assertTrue(tempFile.exists()); assertTrue(tempFile.exists());
ZUGFeRDValidator zfv = new ZUGFeRDValidator(); ZUGFeRDValidator zfv = new ZUGFeRDValidator();