Added some tests, history, made it possible to skip invoking parse()

This commit is contained in:
Jochen Stärk
2018-07-20 14:30:24 +02:00
parent 2ccc244790
commit 0d87ce02ca
4 changed files with 86 additions and 19 deletions

View File

@@ -19,6 +19,7 @@
package org.mustangproject.ZUGFeRD;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
@@ -366,6 +367,37 @@ 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();
// this resembles the data written in MustangReaderWriterCustomXMLTest
assertEquals(amount, "1005.55");
}
public void testMigratePDFA1ToA3() throws IOException {
// just make sure there is no Exception
InputStream SOURCE_PDF = this.getClass()
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20171118_506blanko.pdf");
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA1Factory().setAttachZUGFeRDHeaders(false).load(SOURCE_PDF);
File tempFile = File.createTempFile("ZUGFeRD-", "-test");
ze.export(tempFile.getName());
tempFile.deleteOnExit();
}
/**
* The exporter test bases on @{code
* ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds

Binary file not shown.