Merge pull request #107 from swsch/js

iron out javadoc errors and warnings
This commit is contained in:
Jochen Staerk
2019-07-22 13:29:52 +02:00
committed by GitHub
6 changed files with 36 additions and 35 deletions

View File

@@ -49,7 +49,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
// //////// TESTS // //////// TESTS
// ////////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////////
public void testCustomZF2Export() throws Exception { public void testCustomZF2Export() {
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20171118_506custom.pdf"; final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20171118_506custom.pdf";
// the writing part // the writing part
@@ -288,10 +288,10 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
* ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds * ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds
* metadata, writes to @{code ./target/testout-*} and then imports to check the * metadata, writes to @{code ./target/testout-*} and then imports to check the
* values. It would not make sense to have it run before the less complex * 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 * importer test (which is probably redundant). As only Name Ascending is
* supported for Test Unit sequence, I renamed the Exporter Test test-Z-Export * supported for Test Unit sequence, I renamed the Exporter Test test-Z-Export
*/ */
public void testCustomZF1Export() throws Exception { public void testCustomZF1Export() {
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20170509_505custom.pdf"; final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20170509_505custom.pdf";
// the writing part // the writing part

View File

@@ -170,13 +170,11 @@ public class MustangReaderWriterEdgeTest extends MustangReaderTestCase {
/** /**
* The importer test imports from ./src/test/MustangGnuaccountingBeispielRE-20170509_505.pdf to check the values. * The importer test imports from ./src/test/MustangGnuaccountingBeispielRE-20170509_505.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 * As only Name Ascending is supported for Test Unit sequence, I renamed the this test-A-Import to run before
* testZExport * testZExport
*
* @throws IOException
*/ */
public void testAImport() throws IOException { public void testAImport() {
InputStream inputStream = this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf"); InputStream inputStream = this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf");
ZUGFeRDImporter zi = new ZUGFeRDImporter(inputStream); ZUGFeRDImporter zi = new ZUGFeRDImporter(inputStream);
@@ -195,12 +193,11 @@ public class MustangReaderWriterEdgeTest extends MustangReaderTestCase {
/** /**
* The exporter test bases on @{code ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds metadata, * The exporter test bases on @{code ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds metadata,
* writes * writes to @{code ./target/testout-*} and then imports to check the values.
* to @{code ./target/testout-*} 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).
* 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
* --> as only Name Ascending is supported for Test Unit sequence, I renamed the Exporter Test test-Z-Export
*/ */
public void testEdgeExport() throws Exception { public void testEdgeExport() {
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20170509_505newEdge.pdf"; final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20170509_505newEdge.pdf";
// the writing part // the writing part
@@ -218,6 +215,8 @@ public class MustangReaderWriterEdgeTest extends MustangReaderTestCase {
String theXML = new String(ze.getProvider().getXML()); String theXML = new String(ze.getProvider().getXML());
assertTrue(theXML.contains("<rsm:CrossIndustryDocument")); assertTrue(theXML.contains("<rsm:CrossIndustryDocument"));
ze.export(TARGET_PDF); ze.export(TARGET_PDF);
} catch (IOException e) {
fail("IOException should not happen in testEdgeExport");
} }
// now check the contents (like MustangReaderTest) // now check the contents (like MustangReaderTest)

View File

@@ -184,15 +184,12 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
// ////////////////////////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////////////////////////
/** /**
* The importer test imports from * The importer test imports from ./src/test/MustangGnuaccountingBeispielRE-20170509_505.pdf to check the
* ./src/test/MustangGnuaccountingBeispielRE-20170509_505.pdf to check the * values. As only Name Ascending is supported for Test Unit sequence, I renamed the this testAImport
* values. --> as only Name Ascending is supported for Test Unit sequence, I * to run before testZExport
* renamed the this test-A-Export to run before testZExport
*
* @throws IOException
*/ */
public void testAImport() throws IOException { public void testAImport() {
InputStream inputStream = this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf"); InputStream inputStream = this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf");
ZUGFeRDImporter zi = new ZUGFeRDImporter(inputStream); ZUGFeRDImporter zi = new ZUGFeRDImporter(inputStream);
@@ -206,7 +203,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
assertEquals(zi.getForeignReference(), "RE-20170509/505"); assertEquals(zi.getForeignReference(), "RE-20170509/505");
} }
public void testForeignImport() throws IOException { public void testForeignImport() {
InputStream inputStream = this.getClass().getResourceAsStream("/zugferd_invoice.pdf"); InputStream inputStream = this.getClass().getResourceAsStream("/zugferd_invoice.pdf");
ZUGFeRDImporter zi = new ZUGFeRDImporter(inputStream); ZUGFeRDImporter zi = new ZUGFeRDImporter(inputStream);
@@ -343,10 +340,10 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
* ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds * ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds
* metadata, writes to @{code ./target/testout-*} and then imports to check the * metadata, writes to @{code ./target/testout-*} and then imports to check the
* values. It would not make sense to have it run before the less complex * 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 * importer test (which is probably redundant). As only Name Ascending is
* supported for Test Unit sequence, I renamed the Exporter Test test-Z-Export * supported for Test Unit sequence, I renamed the Exporter Test test-Z-Export
*/ */
public void testZExport() throws Exception { public void testZExport() {
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20171118_506new.pdf"; final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20171118_506new.pdf";
@@ -370,6 +367,8 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
// assertFalse(pdfContent.indexOf("<pdfaSchema:prefix>zf</pdfaSchema:prefix>") == -1); // assertFalse(pdfContent.indexOf("<pdfaSchema:prefix>zf</pdfaSchema:prefix>") == -1);
// assertFalse(pdfContent.indexOf("urn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#") == -1); // assertFalse(pdfContent.indexOf("urn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#") == -1);
} catch (IOException e) {
fail("IOException should not happen in testZExport");
} }
// now check the contents (like MustangReaderTest) // now check the contents (like MustangReaderTest)
@@ -423,11 +422,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
assertEquals(zi.getForeignReference(), getNumber()); assertEquals(zi.getForeignReference(), getNumber());
} }
/** public void testExceptionOnPDF14() {
* @throws Exception
* @Test(expected = IndexOutOfBoundsException.class)
*/
public void testExceptionOnPDF14() throws Exception {
final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20170509_505new.pdf"; final String TARGET_PDF = "./target/testout-MustangGnuaccountingBeispielRE-20170509_505new.pdf";

View File

@@ -34,6 +34,10 @@ public class ResourceUtilities {
/** /**
* Loading a File into a String using a certain encoding and file path * Loading a File into a String using a certain encoding and file path
* @param encoding the charset used in the file
* @param path the path to the file
* @return the file contents as a String
* @throws IOException if the file cannot be read
*/ */
public static String readFile(Charset encoding, String path) throws IOException { public static String readFile(Charset encoding, String path) throws IOException {
byte[] content = Files.readAllBytes(Paths.get(path)); byte[] content = Files.readAllBytes(Paths.get(path));
@@ -42,6 +46,10 @@ public class ResourceUtilities {
/** /**
* Saving a String as a file to a certain file path * Saving a String as a file to a certain file path
* @param encoding the charset used in the file
* @param path the path to the file
* @param content the contents of the file
* @throws FileNotFoundException if the file cannot be found
*/ */
public static void saveFile(Charset encoding, String path, String content) throws FileNotFoundException { public static void saveFile(Charset encoding, String path, String content) throws FileNotFoundException {
@@ -147,7 +155,7 @@ public class ResourceUtilities {
/** /**
* To fix the 3 slashes bug for File URI: For example: * To fix the 3 slashes bug for File URI: For example:
* file:/C:/work/test.txt -> file:///C:/work/test.txt * file:/C:/work/test.txt gives file:///C:/work/test.txt
* *
* @param u - the File URI * @param u - the File URI
* @return the String of the URI * @return the String of the URI

View File

@@ -41,7 +41,7 @@ import static org.junit.Assert.assertFalse;
* will be migrated to <code>src/test/resources/migration/output</code>. * will be migrated to <code>src/test/resources/migration/output</code>.
* If there is a similar named file as test reference <code>src/test/resources/migration/reference</code> a test * If there is a similar named file as test reference <code>src/test/resources/migration/reference</code> a test
* will be triggered for every single file. * will be triggered for every single file.
* <p/> *
* Note: Any 'ZUGFeRD1' will be exchanged to 'ZUGFeRD2' during migration and adequate reference will be searched for. * Note: Any 'ZUGFeRD1' will be exchanged to 'ZUGFeRD2' during migration and adequate reference will be searched for.
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)

View File

@@ -170,13 +170,10 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
// //////// TESTS ////////////////////////////////////////////////////////////////////////////////////////// // //////// TESTS //////////////////////////////////////////////////////////////////////////////////////////
/** /**
* The exporter test bases on @{code ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds metadata, * The exporter test bases on @{code ./src/test/MustangGnuaccountingBeispielRE-20170509_505PDFA3.pdf}, adds metadata,
* writes * writes to @{code ./target/testout-*} and then imports to check the values.
* to @{code ./target/testout-*} 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 testEdgeExport() throws Exception { public void testEdgeExport() {
// the writing part // the writing part
@@ -194,6 +191,8 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
String theXML = new String(ze.getProvider().getXML()); String theXML = new String(ze.getProvider().getXML());
assertTrue(theXML.contains("<rsm:CrossIndustryDocument")); assertTrue(theXML.contains("<rsm:CrossIndustryDocument"));
ze.export(TARGET_PDF); ze.export(TARGET_PDF);
} catch (IOException e) {
fail("IOException should not be raised in testEdgeExport");
} }
// now check the contents (like MustangReaderTest) // now check the contents (like MustangReaderTest)