Skip to content

Commit 24a1e3a

Browse files
committed
PDFBOX-6026: test serializer results
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1926801 13f79535-47bb-0310-9956-ffa450edef68
1 parent ff20d49 commit 24a1e3a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

xmpbox/src/test/java/org/apache/xmpbox/schema/PDFAIdentificationOthersTest.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,22 @@
2121

2222
package org.apache.xmpbox.schema;
2323

24+
import java.io.ByteArrayOutputStream;
25+
import javax.xml.transform.TransformerException;
2426
import static org.junit.jupiter.api.Assertions.assertEquals;
2527
import static org.junit.jupiter.api.Assertions.assertThrows;
2628

2729
import org.apache.xmpbox.XMPMetadata;
2830
import org.apache.xmpbox.type.BadFieldValueException;
31+
import org.apache.xmpbox.xml.DomXmpParser;
32+
import org.apache.xmpbox.xml.XmpParsingException;
33+
import org.apache.xmpbox.xml.XmpSerializer;
2934
import org.junit.jupiter.api.Test;
3035

3136
class PDFAIdentificationOthersTest
3237
{
3338
@Test
34-
void testPDFAIdentification() throws BadFieldValueException
39+
void testPDFAIdentification() throws BadFieldValueException, TransformerException, XmpParsingException
3540
{
3641
XMPMetadata metadata = XMPMetadata.createXMPMetadata();
3742
PDFAIdentificationSchema pdfaid = metadata.createAndAddPDFAIdentificationSchema();
@@ -55,7 +60,18 @@ void testPDFAIdentification() throws BadFieldValueException
5560
// check retrieve this schema in metadata
5661
assertEquals(pdfaid, metadata.getPDFAIdentificationSchema());
5762

58-
// SaveMetadataHelper.serialize(metadata, true, System.out);
63+
ByteArrayOutputStream bos = new ByteArrayOutputStream();
64+
new XmpSerializer().serialize(metadata, bos, true);
65+
XMPMetadata rxmp = new DomXmpParser().parse(bos.toByteArray());
66+
pdfaid = rxmp.getPDFAIdentificationSchema();
67+
68+
assertEquals(versionId, pdfaid.getPart());
69+
assertEquals(amdId, pdfaid.getAmendment());
70+
assertEquals(conformance, pdfaid.getConformance());
71+
72+
assertEquals("" + versionId, pdfaid.getPartProperty().getStringValue());
73+
assertEquals(amdId, pdfaid.getAmdProperty().getStringValue());
74+
assertEquals(conformance, pdfaid.getConformanceProperty().getStringValue());
5975
}
6076

6177
@Test

0 commit comments

Comments
 (0)