updated reading of invoice attachments

This commit is contained in:
jstaerk
2024-08-08 15:33:00 +02:00
parent 234a43ff77
commit 23244cffa6
6 changed files with 28 additions and 42 deletions

View File

@@ -133,7 +133,7 @@ public class XRTest extends TestCase {
} catch (IOException e) {
throw new RuntimeException(e);
}
List<FileAttachment> attachedFiles=zii.getFileAttachments();
List<FileAttachment> attachedFiles=zii.getFileAttachmentsXML();
assertNotNull(attachedFiles);
assertEquals(attachedFiles.size(), 1);

View File

@@ -21,6 +21,7 @@
*/
package org.mustangproject.ZUGFeRD;
import org.mustangproject.FileAttachment;
import org.mustangproject.Invoice;
import javax.xml.xpath.XPathExpressionException;
@@ -296,15 +297,12 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
byte[] fileB=null;
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("./target/testout-ZF2PushAttachments.pdf");
for (String filename:zii.getEmbeddedFilenames()
) {
if (filename.equals("one.pdf")) {
fileA=zii.getEmbeddedFile(filename);
} else if (filename.equals("two.pdf")) {
fileB=zii.getEmbeddedFile(filename);
for (FileAttachment fa:zii.getFileAttachmentsPDF()) {
if (fa.getFilename().equals("one.pdf")) {
fileA=fa.getData();
} else if (fa.getFilename().equals("two.pdf")) {
fileB=fa.getData();
}
}
byte[] b = {12, 13}; // the sample data that was used to write the files