avoid deprecated ZUGFeRDExporter methods

In most cases this is achieved by using the corresponding factory methods.
Since they have to be set _somehow_, I introduced a new public method
`ZUGFeRDExporter.configure` to keep these calls local to the class.
This is called once in A3Factory.load(byte[]).

The deprecated Exporter setters could now be made private but that could
break existing code.
This commit is contained in:
Stefan Schmiedl
2019-08-07 14:53:39 +02:00
parent 2f3085e727
commit eaaf97eb6e
6 changed files with 26 additions and 26 deletions

View File

@@ -300,7 +300,10 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
try {
InputStream SOURCE_PDF = this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
ZUGFeRDExporter zea1 = new ZUGFeRDExporterFromA1Factory().setProducer("My Application").setCreator("Test").setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel.BASIC)
ZUGFeRDExporter zea1 = new ZUGFeRDExporterFromA1Factory()
.setProducer("My Application")
.setCreator("Test")
.setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel.BASIC)
.load(SOURCE_PDF);
/* we have much more information than just in the basic profile (comfort or extended) but it's perfectly valid to provide more information, just not less. */
String ownZUGFeRDXML = "<rsm:CrossIndustryDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15\" xmlns:rsm=\"urn:ferd:CrossIndustryDocument:invoice:1p0\">\n"

View File

@@ -208,9 +208,9 @@ public class MustangReaderWriterEdgeTest extends MustangReaderTestCase {
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA3Factory()
.setProducer("My Application")
.setCreator(System.getProperty("user.name"))
.setZUGFeRDVersion(1)
.ignorePDFAErrors()
.load(SOURCE_PDF)) {
ze.setZUGFeRDVersion(1);
ze.PDFattachZugferdFile(this);
String theXML = new String(ze.getProvider().getXML());
assertTrue(theXML.contains("<rsm:CrossIndustryDocument"));

View File

@@ -183,10 +183,9 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
ZUGFeRDExporter ze = new ZUGFeRDExporterFromA3Factory()
.setProducer("My Application")
.setCreator(System.getProperty("user.name"))
.setZUGFeRDVersion(2)
.setZUGFeRDVersion(1)
.ignorePDFAErrors()
.load(SOURCE_PDF)) {
ze.setZUGFeRDVersion(1);
ze.PDFattachZugferdFile(this);
String theXML = new String(ze.getProvider().getXML());
assertTrue(theXML.contains("<rsm:CrossIndustryDocument"));