corrected tests

This commit is contained in:
Jochen Stärk
2020-05-24 19:49:05 +02:00
parent b8fa899f60
commit dbdcdbe75f
5 changed files with 50 additions and 34 deletions

View File

@@ -56,7 +56,7 @@ public class ZUGFeRDExporter implements Closeable {
public static final int DefaultZUGFeRDVersion = 2;
private boolean isFacturX = false;
private boolean isFacturX = true;
/**
* To use the ZUGFeRD exporter, implement IZUGFeRDExportableTransaction in
@@ -210,11 +210,21 @@ public class ZUGFeRDExporter implements Closeable {
setZUGFeRDVersion(DefaultZUGFeRDVersion);
}
/**
* Factur-X is now set by default since ZF 2.1, you have to disable it if you dont wont it
* Generate ZF2.1 files with filename factur-x.xml
* @deprecated
* */
public void setFacturX() {
setZUGFeRDVersion(2);
isFacturX = true;
}
/***
* Generate ZF2.0/2.1 files with filename zugferd-invoice.xml instead of factur-x.xml
*/
public void disableFacturX() {
isFacturX = false;
}
/**
* All files are PDF/A-3, setConformance refers to the level conformance.
*

View File

@@ -257,7 +257,6 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
" </rsm:SupplyChainTradeTransaction>\n" +
"</rsm:CrossIndustryInvoice>";
zea1.setZUGFeRDXMLData(ownZUGFeRDXML.getBytes("UTF-8"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
zea1.disableAutoClose(true);
zea1.export(TARGET_PDF);
@@ -265,7 +264,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
zea1.close();
String pdfContent = baos.toString("UTF-8");
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);
assertFalse(pdfContent.indexOf("<fx:ConformanceLevel>EN 16931</fx:ConformanceLevel>") == -1);
} catch (IOException e) {
e.printStackTrace();
@@ -303,6 +302,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
ZUGFeRDExporter zea1 = new ZUGFeRDExporterFromA1Factory()
.setProducer("My Application")
.setCreator("Test")
.setZUGFeRDVersion(1)
.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. */
@@ -448,7 +448,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
zea1.close();
String pdfContent = baos.toString("UTF-8");
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>BASIC</zf:ConformanceLevel>") == -1);
assertFalse(pdfContent.indexOf("<fx:ConformanceLevel>BASIC</fx:ConformanceLevel>") == -1);
} catch (IOException e) {
e.printStackTrace();