Remove \t and whitespaces from xml

This commit is contained in:
Sebastian Sieber
2022-03-21 16:23:53 +01:00
parent 577ac0e930
commit 4077700b2e
4 changed files with 223 additions and 226 deletions

View File

@@ -24,6 +24,7 @@ public interface IZUGFeRDTradeSettlementDebit extends IZUGFeRDTradeSettlement {
@Override
default String getSettlementXML() { default String getSettlementXML() {
@@ -38,6 +39,7 @@ public interface IZUGFeRDTradeSettlementDebit extends IZUGFeRDTradeSettlement {
return xml; return xml;
} }
@Override
default String getPaymentXML() { default String getPaymentXML() {
return "<ram:DirectDebitMandateID>"+XMLTools.encodeXML(getMandate())+"</ram:DirectDebitMandateID>"; return "<ram:DirectDebitMandateID>"+XMLTools.encodeXML(getMandate())+"</ram:DirectDebitMandateID>";
} }

View File

@@ -3,11 +3,6 @@ package org.mustangproject.validator;
import static org.xmlunit.assertj.XmlAssert.assertThat; import static org.xmlunit.assertj.XmlAssert.assertThat;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.xml.transform.Source; import javax.xml.transform.Source;
@@ -21,9 +16,9 @@ public class XMLValidatorTest extends ResourceCase {
// ignored for the // ignored for the
// time being // time being
ValidationContext ctx = new ValidationContext(null); final ValidationContext ctx = new ValidationContext(null);
XMLValidator xv = new XMLValidator(ctx); final XMLValidator xv = new XMLValidator(ctx);
XPathEngine xpath = new JAXPXPathEngine(); final XPathEngine xpath = new JAXPXPathEngine();
File tempFile = getResourceAsFile("invalidV2.xml"); File tempFile = getResourceAsFile("invalidV2.xml");
Source source; Source source;
String content; String content;
@@ -72,7 +67,7 @@ public class XMLValidatorTest extends ResourceCase {
xv.setFilename(tempFile.getAbsolutePath()); xv.setFilename(tempFile.getAbsolutePath());
xv.validate(); xv.validate();
} catch (IrrecoverableValidationError e) { } catch (final IrrecoverableValidationError e) {
noException = false; //expecting a fatal error, i.e. an exception noException = false; //expecting a fatal error, i.e. an exception
} }
assertFalse(noException); assertFalse(noException);
@@ -87,10 +82,10 @@ public class XMLValidatorTest extends ResourceCase {
xv.setFilename(tempFile.getAbsolutePath()); xv.setFilename(tempFile.getAbsolutePath());
xv.validate(); xv.validate();
} catch (IrrecoverableValidationError e) { } catch (final IrrecoverableValidationError e) {
noException = false; noException = false;
} }
String res = xv.getXMLResult(); final String res = xv.getXMLResult();
/*OutputStream os = null; /*OutputStream os = null;
try { try {
os = new FileOutputStream(new File("return.xml")); os = new FileOutputStream(new File("return.xml"));
@@ -166,7 +161,7 @@ public class XMLValidatorTest extends ResourceCase {
source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build(); source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
content = xpath.evaluate("/validation/summary/@status", source); content = xpath.evaluate("/validation/summary/@status", source);
assertEquals("invalid", content); assertEquals("invalid", content);
} catch (IrrecoverableValidationError e) { } catch (final IrrecoverableValidationError e) {
// ignore, will be in XML output anyway // ignore, will be in XML output anyway
noException = false; noException = false;
} }
@@ -177,7 +172,7 @@ public class XMLValidatorTest extends ResourceCase {
xv.setFilename(tempFile.getAbsolutePath()); xv.setFilename(tempFile.getAbsolutePath());
xv.validate(); xv.validate();
} catch (IrrecoverableValidationError e) { } catch (final IrrecoverableValidationError e) {
// do expect this! // do expect this!
noException = false; noException = false;
} }
@@ -187,8 +182,8 @@ public class XMLValidatorTest extends ResourceCase {
} }
public void testZF1XMLValidation() { public void testZF1XMLValidation() {
ValidationContext ctx = new ValidationContext(null); final ValidationContext ctx = new ValidationContext(null);
XMLValidator xv = new XMLValidator(ctx); final XMLValidator xv = new XMLValidator(ctx);
File tempFile = getResourceAsFile("validV1.xml"); File tempFile = getResourceAsFile("validV1.xml");
try { try {
xv.setFilename(tempFile.getAbsolutePath()); xv.setFilename(tempFile.getAbsolutePath());
@@ -205,16 +200,16 @@ public class XMLValidatorTest extends ResourceCase {
xv.validate(); xv.validate();
assertEquals(true, xv.getXMLResult().contains("<error type=\"26\"")); assertEquals(true, xv.getXMLResult().contains("<error type=\"26\""));
} catch (IrrecoverableValidationError e) { } catch (final IrrecoverableValidationError e) {
// ignore, will be in XML output anyway // ignore, will be in XML output anyway
} }
} }
public void testXRValidation() { public void testXRValidation() {
ValidationContext ctx = new ValidationContext(null); final ValidationContext ctx = new ValidationContext(null);
XMLValidator xv = new XMLValidator(ctx); final XMLValidator xv = new XMLValidator(ctx);
XPathEngine xpath = new JAXPXPathEngine(); final XPathEngine xpath = new JAXPXPathEngine();
File tempFile = getResourceAsFile("validXRv2.xml"); File tempFile = getResourceAsFile("validXRv2.xml");
try { try {
@@ -234,7 +229,7 @@ public class XMLValidatorTest extends ResourceCase {
assertEquals("invalid", content); assertEquals("invalid", content);
} catch (IrrecoverableValidationError e) { } catch (final IrrecoverableValidationError e) {
// ignore, will be in XML output anyway // ignore, will be in XML output anyway
} }