Added some tests, history, made it possible to skip invoking parse()
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user