diff --git a/History.md b/History.md
index 0df62d91a..87cdb5949 100644
--- a/History.md
+++ b/History.md
@@ -10,6 +10,8 @@
- javadoc export
- prompt for source file for validation has to be pdf
- be able to disable "source pdf set to timeout"
+- automated tests zuv/verapdf validate created library test files
+- unify loggers
done
- 2.1 now default
- pushprovider
diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java
index 68249e8bc..7d5db9acd 100644
--- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java
+++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporter.java
@@ -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 @@ private void init() {
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.
*
diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterCustomXMLTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterCustomXMLTest.java
index e1908c7b2..ff87ab099 100644
--- a/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterCustomXMLTest.java
+++ b/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterCustomXMLTest.java
@@ -257,7 +257,6 @@ public void testCustomZF2Export() {
" \n" +
"";
zea1.setZUGFeRDXMLData(ownZUGFeRDXML.getBytes("UTF-8"));
-
ByteArrayOutputStream baos = new ByteArrayOutputStream();
zea1.disableAutoClose(true);
zea1.export(TARGET_PDF);
@@ -265,7 +264,7 @@ public void testCustomZF2Export() {
zea1.close();
String pdfContent = baos.toString("UTF-8");
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
- assertFalse(pdfContent.indexOf("EN 16931") == -1);
+ assertFalse(pdfContent.indexOf("EN 16931") == -1);
} catch (IOException e) {
e.printStackTrace();
@@ -303,6 +302,7 @@ public void testCustomZF1Export() {
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 void testCustomZF1Export() {
zea1.close();
String pdfContent = baos.toString("UTF-8");
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
- assertFalse(pdfContent.indexOf("BASIC") == -1);
+ assertFalse(pdfContent.indexOf("BASIC") == -1);
} catch (IOException e) {
e.printStackTrace();
diff --git a/validator/src/test/java/org/mustangproject/library/extended/XMLValidatorTest.java b/validator/src/test/java/org/mustangproject/library/extended/XMLValidatorTest.java
index 36e755663..c44527b44 100644
--- a/validator/src/test/java/org/mustangproject/library/extended/XMLValidatorTest.java
+++ b/validator/src/test/java/org/mustangproject/library/extended/XMLValidatorTest.java
@@ -111,35 +111,6 @@ public void testZF2XMLValidation() {
.contains(
"In Deutschland sind die Profile MINIMUM und BASIC WL nur als Buchungshilfe (TypeCode: 751) zugelassen.");
- ctx.clear();
-
- try {
-
- tempFile = getResourceAsFile("validv2.xml");
-
- xv.setFilename(tempFile.getAbsolutePath());
-
- xv.validate();
- } catch (IrrecoverableValidationError e) {
- // ignore, will be in XML output anyway
- }
- res = xv.getXMLResult();
-
- content = "" + res + "";
-
- assertThat(content).valueByXPath("count(//error)")
- .asInt()
- .isEqualTo(0);
-
- assertThat(content).valueByXPath("count(//notice)")
- .asInt()
- .isEqualTo(3); // 3 notices RE XRechnung
- assertThat(content).valueByXPath("/validation/summary/@status")
- .asString()
- .isEqualTo("valid");// expect to be valid because XR notices are, well, only notices
- assertThat(content).valueByXPath("/validation/xml/@status")
- .asString()
- .isEqualTo("valid");
ctx.clear();
tempFile = getResourceAsFile("validV2Basic.xml");
diff --git a/validator/src/test/java/org/mustangproject/library/extended/ZUGFeRDValidatorTest.java b/validator/src/test/java/org/mustangproject/library/extended/ZUGFeRDValidatorTest.java
index 5e09d74be..e79a01d10 100644
--- a/validator/src/test/java/org/mustangproject/library/extended/ZUGFeRDValidatorTest.java
+++ b/validator/src/test/java/org/mustangproject/library/extended/ZUGFeRDValidatorTest.java
@@ -46,5 +46,38 @@ public void testPDFValidation() {
assertEquals(true, res.contains("status=\"valid\""));
assertEquals(false, res.contains("status=\"invalid\""));
+ tempFile = getResourceAsFile("validAvoir_FR_type380_BASICWL.pdf");
+ zfv = new ZUGFeRDValidator();
+
+ res = zfv.validate(tempFile.getAbsolutePath());
+ assertEquals(true, res.contains("status=\"valid\""));
+ assertEquals(false, res.contains("status=\"invalid\""));
+
+ }
+
+ /***
+ * the XMLValidatorTests only cover the part, this one includes the root element and
+ * the global part as well
+ */
+ public void testXMLValidation() {
+ File tempFile = getResourceAsFile("validV2.xml");
+ ZUGFeRDValidator zfv = new ZUGFeRDValidator();
+
+ String res = zfv.validate(tempFile.getAbsolutePath());
+
+ assertThat(res).valueByXPath("count(//error)")
+ .asInt()
+ .isEqualTo(0);
+
+ assertThat(res).valueByXPath("count(//notice)")
+ .asInt()
+ .isEqualTo(3); // 3 notices RE XRechnung
+ assertThat(res).valueByXPath("/validation/summary/@status")
+ .asString()
+ .isEqualTo("valid");// expect to be valid because XR notices are, well, only notices
+ assertThat(res).valueByXPath("/validation/xml/summary/@status")
+ .asString()
+ .isEqualTo("valid");
+
}
}