diff --git a/mustang/pom.xml b/mustang/pom.xml
index 3a715e3f..f88270c9 100644
--- a/mustang/pom.xml
+++ b/mustang/pom.xml
@@ -4,7 +4,7 @@
org.mustangproject.ZUGFeRD
mustang
- 1.1.0.alpha
+ 1.1.0
@@ -48,7 +48,7 @@
junit
junit
- 3.8.1
+ 4.11
test
diff --git a/mustang/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderTest.java b/mustang/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderTest.java
deleted file mode 100644
index 9608d396..00000000
--- a/mustang/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.mustangproject.ZUGFeRD;
-
-import java.io.IOException;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Unit test for simple App.
- */
-public class MustangReaderTest extends TestCase {
- /**
- * Create the test case
- *
- * @param testName
- * name of the test case
- */
- public MustangReaderTest(String testName) {
- super(testName);
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite() {
- return new TestSuite(MustangReaderTest.class);
- }
-
- /**
- * Rigourous Test :-)
- */
- public void testImport() {
- ZUGFeRDImporter zi = new ZUGFeRDImporter();
- zi.extract("./src/test/MustangGnuaccountingBeispielRE-20140703_502.pdf");
- // Reading ZUGFeRD
-
- String amount=null;
- String bic=null;
- String iban=null;
- String holder=null;
- String ref=null;
-
- if (zi.canParse()) {
- zi.parse();
- amount=zi.getAmount();
- bic=zi.getBIC();
- iban=zi.getIBAN();
- holder=zi.getHolder();
- ref=zi.getForeignReference();
- }
-
-
- assertEquals(amount, "571.04");
- assertEquals(bic, "COBADEFXXX");
- assertEquals(iban, "DE88 2008 0000 0970 3757 00");
- assertEquals(holder, "Bei Spiel GmbH");
- assertEquals(ref, "RE-20140703/502");
-
-
- }
-
-}
diff --git a/mustang/src/test/java/org/mustangproject/ZUGFeRD/MustangWriterTest.java b/mustang/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterTest.java
similarity index 78%
rename from mustang/src/test/java/org/mustangproject/ZUGFeRD/MustangWriterTest.java
rename to mustang/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterTest.java
index ae163ca2..b0da31bc 100644
--- a/mustang/src/test/java/org/mustangproject/ZUGFeRD/MustangWriterTest.java
+++ b/mustang/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterTest.java
@@ -2,6 +2,7 @@ package org.mustangproject.ZUGFeRD;
import java.io.IOException;
+
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
@@ -15,9 +16,11 @@ import junit.framework.TestSuite;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.jempbox.xmp.*;
+import org.junit.*;
+import org.junit.runners.MethodSorters;
-
-public class MustangWriterTest extends TestCase implements IZUGFeRDExportableTransaction {
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExportableTransaction {
@Override
public Date getDeliveryDate() {
@@ -261,22 +264,84 @@ public class MustangWriterTest extends TestCase implements IZUGFeRDExportableTra
}
- private void apply() {
+
+ /**
+ * Create the test case
+ *
+ * @param testName
+ * name of the test case
+ */
+ public MustangReaderWriterTest(String testName) {
+ super(testName);
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite() {
+ return new TestSuite(MustangReaderWriterTest.class);
+ }
+
+////////// TESTS //////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * The importer test imports from ./src/test/MustangGnuaccountingBeispielRE-20140703_502.pdf to check the values.
+ *
+ * --> as only Name Ascending is supported for Test Unit sequence, I renamed the this test-A-Export to run before testZExport
+ */
+
+ public void testAImport() {
+ ZUGFeRDImporter zi = new ZUGFeRDImporter();
+ zi.extract("./src/test/MustangGnuaccountingBeispielRE-20140703_502.pdf");
+ // Reading ZUGFeRD
+
+ String amount=null;
+ String bic=null;
+ String iban=null;
+ String holder=null;
+ String ref=null;
+
+ if (zi.canParse()) {
+ zi.parse();
+ amount=zi.getAmount();
+ bic=zi.getBIC();
+ iban=zi.getIBAN();
+ holder=zi.getHolder();
+ ref=zi.getForeignReference();
+ }
+
+
+ assertEquals(amount, "571.04");
+ assertEquals(bic, "COBADEFXXX");
+ assertEquals(iban, "DE88 2008 0000 0970 3757 00");
+ assertEquals(holder, "Bei Spiel GmbH");
+ assertEquals(ref, "RE-20140703/502");
+
+
+ }
+
+
+ /**
+ * The exporter test bases on ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf, adds metadata, writes
+ * (to ./src/test/MustangGnuaccountingBeispielRE-20140703_502new.pdf) and then imports to check the values.
+ *
+ * It would not make sense to have it run before the less complex importer test (which is probably redundant)
+ * --> as only Name Ascending is supported for Test Unit sequence, I renamed the Exporter Test test-Z-Export
+ */
+ public void testZExport() {
+ // generate ./src/test/MustangGnuaccountingBeispielRE-20140703_502new.pdf from ./src/test/MustangGnuaccountingBeispielRE-20140703_502blank.pdf:
+ // the writing part
+
PDDocument doc;
try {
- System.out.println("Lese Blanko-PDF");
doc = PDDocument
.load("./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf");
// automatically add Zugferd to all outgoing invoices
ZUGFeRDExporter ze = new ZUGFeRDExporter();
- System.out.println("Wandle in PDF/A-3u um");
ze.PDFmakeA3compliant(doc, "My Application",
System.getProperty("user.name"), true);
- System.out.println("ZUGFeRD-Daten generieren und anhängen");
ze.PDFattachZugferdFile(doc, this);
- System.out.println("Schreibe ZUGFeRD-PDF");
doc.save("./src/test/MustangGnuaccountingBeispielRE-20140703_502new.pdf");
- System.out.println("Fertig.");
} catch (IOException e) {
e.printStackTrace();
} catch (TransformerException e) {
@@ -285,31 +350,7 @@ public class MustangWriterTest extends TestCase implements IZUGFeRDExportableTra
e.printStackTrace();
}
- }
-
- /**
- * Create the test case
- *
- * @param testName
- * name of the test case
- */
- public MustangWriterTest(String testName) {
- super(testName);
- }
- /**
- * @return the suite of tests being tested
- */
- public static Test suite() {
- return new TestSuite(MustangWriterTest.class);
- }
-
-
-
- public void testExport() {
- // generate ./src/test/MustangGnuaccountingBeispielRE-20140703_502new.pdf from ./src/test/MustangGnuaccountingBeispielRE-20140703_502blank.pdf:
- // the writing part
- apply();
// now check the contents (like MustangReaderTest)
ZUGFeRDImporter zi = new ZUGFeRDImporter();
zi.extract("./src/test/MustangGnuaccountingBeispielRE-20140703_502new.pdf");
diff --git a/mustang/target/mustang-1.1.0.jar b/mustang/target/mustang-1.1.0.jar
new file mode 100644
index 00000000..88bf3ae3
Binary files /dev/null and b/mustang/target/mustang-1.1.0.jar differ
diff --git a/mustang/target/test-classes/org/mustangproject/ZUGFeRD/AppTest.class b/mustang/target/test-classes/org/mustangproject/ZUGFeRD/AppTest.class
deleted file mode 100644
index 2e71b6d9..00000000
Binary files a/mustang/target/test-classes/org/mustangproject/ZUGFeRD/AppTest.class and /dev/null differ