cleanup two PRs
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
- 538 Mustang validator always claims PDF is invalid if flavour is PDF/A-3A
|
- 538 Mustang validator always claims PDF is invalid if flavour is PDF/A-3A
|
||||||
- 555 be able to validate ubl credit notes
|
- 555 be able to validate ubl credit notes
|
||||||
- when parsing now distinguishing between the parseExceptions StructureException and ArithmetricException
|
- when parsing now distinguishing between the parseExceptions StructureException and ArithmetricException
|
||||||
|
- Import IncludedNotes on invoice extraction #554
|
||||||
|
|
||||||
2.14.2
|
2.14.2
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ package org.mustangproject.ZUGFeRD;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mustangproject.*;
|
import org.mustangproject.*;
|
||||||
|
|
||||||
import javax.xml.xpath.XPathExpressionException;
|
import javax.xml.xpath.XPathExpressionException;
|
||||||
@@ -35,6 +36,9 @@ import java.text.ParseException;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -372,4 +376,24 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testImportIncludedNotes() throws XPathExpressionException, ParseException {
|
||||||
|
InputStream inputStream = this.getClass()
|
||||||
|
.getResourceAsStream("/EN16931_Einfach.pdf");
|
||||||
|
ZUGFeRDInvoiceImporter importer = new ZUGFeRDInvoiceImporter(inputStream);
|
||||||
|
Invoice invoice = importer.extractInvoice();
|
||||||
|
List<IncludedNote> notesWithSubjectCode = invoice.getNotesWithSubjectCode();
|
||||||
|
assertThat(notesWithSubjectCode).hasSize(2);
|
||||||
|
assertThat(notesWithSubjectCode.get(0).getSubjectCode()).isNull();
|
||||||
|
assertThat(notesWithSubjectCode.get(0).getContent()).isEqualTo("Rechnung gemäß Bestellung vom 01.11.2024.");
|
||||||
|
assertThat(notesWithSubjectCode.get(1).getSubjectCode()).isEqualTo(SubjectCode.REG);
|
||||||
|
assertThat(notesWithSubjectCode.get(1).getContent()).isEqualTo("Lieferant GmbH\t\t\t\t\n"
|
||||||
|
+ "Lieferantenstraße 20\t\t\t\t\n"
|
||||||
|
+ "80333 München\t\t\t\t\n"
|
||||||
|
+ "Deutschland\t\t\t\t\n"
|
||||||
|
+ "Geschäftsführer: Hans Muster\n"
|
||||||
|
+ "Handelsregisternummer: H A 123");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
package org.mustangproject.ZUGFeRD;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.xml.xpath.XPathExpressionException;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.mustangproject.IncludedNote;
|
|
||||||
import org.mustangproject.Invoice;
|
|
||||||
import org.mustangproject.SubjectCode;
|
|
||||||
|
|
||||||
class ZUGFeRDInvoiceImporterTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void testImportIncludedNotes() throws XPathExpressionException, ParseException {
|
|
||||||
InputStream inputStream = this.getClass()
|
|
||||||
.getResourceAsStream("/EN16931_Einfach.pdf");
|
|
||||||
ZUGFeRDInvoiceImporter importer = new ZUGFeRDInvoiceImporter(inputStream);
|
|
||||||
Invoice invoice = importer.extractInvoice();
|
|
||||||
List<IncludedNote> notesWithSubjectCode = invoice.getNotesWithSubjectCode();
|
|
||||||
assertThat(notesWithSubjectCode).hasSize(2);
|
|
||||||
assertThat(notesWithSubjectCode.get(0).getSubjectCode()).isNull();
|
|
||||||
assertThat(notesWithSubjectCode.get(0).getContent()).isEqualTo("Rechnung gemäß Bestellung vom 01.11.2024.");
|
|
||||||
assertThat(notesWithSubjectCode.get(1).getSubjectCode()).isEqualTo(SubjectCode.REG);
|
|
||||||
assertThat(notesWithSubjectCode.get(1).getContent()).isEqualTo("Lieferant GmbH\t\t\t\t\n"
|
|
||||||
+ "Lieferantenstraße 20\t\t\t\t\n"
|
|
||||||
+ "80333 München\t\t\t\t\n"
|
|
||||||
+ "Deutschland\t\t\t\t\n"
|
|
||||||
+ "Geschäftsführer: Hans Muster\n"
|
|
||||||
+ "Handelsregisternummer: H A 123");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user