closes #581
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
? be able to access ID in error message
|
||||
? log error IDs
|
||||
- closes #579
|
||||
|
||||
- #581
|
||||
|
||||
2.15.0
|
||||
=======
|
||||
|
||||
@@ -28,11 +28,17 @@ import org.junit.FixMethodOrder;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.mustangproject.*;
|
||||
|
||||
import javax.xml.xpath.XPathExpressionException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.text.ParseException;
|
||||
import java.util.Date;
|
||||
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class DeSerializationTest extends TestCase {
|
||||
public class DeSerializationTest extends ResourceCase {
|
||||
public void testJackson() throws JsonProcessingException {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
@@ -50,6 +56,33 @@ public class DeSerializationTest extends TestCase {
|
||||
|
||||
}
|
||||
|
||||
public void testInvoiceLine() throws JsonProcessingException {
|
||||
File inputCII = getResourceAsFile("factur-x.xml");
|
||||
boolean hasExceptions = false;
|
||||
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
|
||||
try {
|
||||
zii.fromXML(new String(Files.readAllBytes(inputCII.toPath()), StandardCharsets.UTF_8));
|
||||
|
||||
} catch (IOException e) {
|
||||
hasExceptions = true;
|
||||
}
|
||||
|
||||
CalculatedInvoice ci=new CalculatedInvoice();
|
||||
try {
|
||||
zii.extractInto(ci);
|
||||
} catch (XPathExpressionException e) {
|
||||
hasExceptions = true;
|
||||
} catch (ParseException e) {
|
||||
hasExceptions = true;
|
||||
}
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
String jsonArray = mapper.writeValueAsString(ci);
|
||||
assertFalse(hasExceptions);
|
||||
assertTrue(jsonArray.contains("lineTotalAmount"));
|
||||
|
||||
}
|
||||
|
||||
public void testAllowanceRead() throws JsonProcessingException {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
Reference in New Issue
Block a user