2121
2222package org .apache .xmpbox .schema ;
2323
24+ import java .io .ByteArrayOutputStream ;
25+ import javax .xml .transform .TransformerException ;
2426import static org .junit .jupiter .api .Assertions .assertEquals ;
2527import static org .junit .jupiter .api .Assertions .assertThrows ;
2628
2729import org .apache .xmpbox .XMPMetadata ;
2830import 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 ;
2934import org .junit .jupiter .api .Test ;
3035
3136class 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