Merge pull request #626 from Adrian-Devries/fix-minor-java-issues

Fix minor java issues
This commit is contained in:
Jochen Staerk
2024-12-20 08:51:43 +01:00
committed by GitHub
4 changed files with 1143 additions and 1115 deletions

View File

@@ -659,6 +659,7 @@ public class ZUGFeRDImporter extends ZUGFeRDInvoiceImporter {
*
* @return a List of LineItem instances
*/
@Deprecated
public List<Item> getLineItemList() {
final List<Node> nodeList = getLineItemNodes();
final List<Item> lineItemList = new ArrayList<>();

View File

@@ -1036,6 +1036,7 @@ public class ZUGFeRDInvoiceImporter {
* for PDF embedded files in FX use getFileAttachmentsPDF()
* @deprecated use invoice.getAdditionalReferencedDocuments
*/
@Deprecated
public List<FileAttachment> getFileAttachmentsXML() {
return new ArrayList<>(Arrays.asList(importedInvoice.getAdditionalReferencedDocuments()));
}

View File

@@ -52,7 +52,9 @@ public class VisualizationTest extends ResourceCase {
/* remove file endings so that tests can also pass after checking
out from git with arbitrary options (which may include CSRF changes)
*/
result = zvi.visualize(CIIinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.FR)
result = zvi.visualize(CIIinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.FR);
Files.write(Paths.get("./target/testout-factur-x-vis.fr.html"), result.getBytes(StandardCharsets.UTF_8));
result = result
.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
@@ -99,12 +101,18 @@ public class VisualizationTest extends ResourceCase {
/* remove file endings so that tests can also pass after checking
out from git with arbitrary options (which may include CSRF changes)
*/
result = zvi.visualize(CIIinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.DE).replace("\r", "").replace("\n", "")
result = zvi.visualize(CIIinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.DE);
Files.write(Paths.get("./target/testout-factur-x-vis-extended.de.html"), result.getBytes(StandardCharsets.UTF_8));
result = result
.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
.replace(" ", "");
File expectedResult = getResourceAsFile("factur-x-vis-extended.de.html");
expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8).replace("\r", "").replace("\n", "")
expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8)
.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
.replace(" ", "");
// remove linebreaks as well...
@@ -141,10 +149,20 @@ public class VisualizationTest extends ResourceCase {
/* remove file endings so that tests can also pass after checking
out from git with arbitrary options (which may include CSRF changes)
*/
result = zvi.visualize(UBLinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.EN).replace("\r", "").replace("\n", "").replace("\t", "").replace(" ", "");
result = zvi.visualize(UBLinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.EN);
Files.write(Paths.get("./target/testout-factur-x-vis-ubl-creditnote.en.html"), result.getBytes(StandardCharsets.UTF_8));
result = result
.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
.replace(" ", "");
File expectedResult = getResourceAsFile("factur-x-vis-ubl-creditnote.en.html");
expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8).replace("\r", "").replace("\n", "").replace("\t", "").replace(" ", "");
expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8)
.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
.replace(" ", "");
// remove linebreaks as well...
} catch (UnsupportedOperationException e) {
@@ -180,12 +198,18 @@ public class VisualizationTest extends ResourceCase {
/* remove file endings so that tests can also pass after checking
out from git with arbitrary options (which may include CSRF changes)
*/
result = zvi.visualize(UBLinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.EN).replace("\r", "").replace("\n", "")
result = zvi.visualize(UBLinputFile.getAbsolutePath(), ZUGFeRDVisualizer.Language.EN);
Files.write(Paths.get("./target/testout-factur-x-vis-ubl.en.html"), result.getBytes(StandardCharsets.UTF_8));
result = result
.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
.replace(" ", "");
File expectedResult = getResourceAsFile("factur-x-vis-ubl.en.html");
expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8).replace("\r", "").replace("\n", "")
expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8)
.replace("\r", "")
.replace("\n", "")
.replace("\t", "")
.replace(" ", "");
// remove linebreaks as well...

View File

@@ -807,12 +807,14 @@ public class ZF2PushTest extends TestCase {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("\\Users\\jstaerk\\temp\\1424413_anonymized.xml");
// ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter("\\Users\\jstaerk\\temp\\1424413_anonymized.xml");
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(this.getClass().getResourceAsStream("/factur-x.xml"));
try {
Invoice i = zii.extractInvoice();
TransactionCalculator tc=new TransactionCalculator(i);
assertEquals(0,tc.getGrandTotal().compareTo(new BigDecimal("442.83")));
// assertEquals(0,tc.getGrandTotal().compareTo(new BigDecimal("442.83")));
assertEquals(0,tc.getGrandTotal().compareTo(new BigDecimal("571.04")));
} catch (XPathExpressionException e) {
fail("XPathExpressionException should not be raised");