You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2025/06/28 04:19:22 UTC

svn commit: r1926791 - /pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java

Author: tilman
Date: Sat Jun 28 04:19:22 2025
New Revision: 1926791

URL: http://svn.apache.org/viewvc?rev=1926791&view=rev
Log:
PDFBOX-6026: test serializer results

Modified:
    pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java

Modified: pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java?rev=1926791&r1=1926790&r2=1926791&view=diff
==============================================================================
--- pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java (original)
+++ pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/schema/AdobePDFErrorsTest.java Sat Jun 28 04:19:22 2025
@@ -21,12 +21,17 @@
 
 package org.apache.xmpbox.schema;
 
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import java.io.ByteArrayOutputStream;
+import javax.xml.transform.TransformerException;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
 import org.apache.xmpbox.XMPMetadata;
 import org.apache.xmpbox.type.BadFieldValueException;
+import org.apache.xmpbox.xml.DomXmpParser;
+import org.apache.xmpbox.xml.XmpParsingException;
+import org.apache.xmpbox.xml.XmpSerializer;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import org.junit.jupiter.api.Test;
 
 class AdobePDFErrorsTest
@@ -35,7 +40,7 @@ class AdobePDFErrorsTest
     private final XMPMetadata metadata = XMPMetadata.createXMPMetadata();
 
     @Test
-    void testPDFAIdentification()
+    void testPDFAIdentification() throws TransformerException, XmpParsingException
     {
         AdobePDFSchema schem = metadata.createAndAddAdobePDFSchema();
 
@@ -63,7 +68,18 @@ class AdobePDFErrorsTest
         // check retrieve this schema in metadata
         assertEquals(schem, metadata.getAdobePDFSchema());
 
-        // SaveMetadataHelper.serialize(metadata, true, System.out)
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        new XmpSerializer().serialize(metadata, bos, true);
+        schem = new DomXmpParser().parse(bos.toByteArray()).getAdobePDFSchema();
+
+        assertEquals("Keywords", schem.getKeywordsProperty().getPropertyName());
+        assertEquals(keywords, schem.getKeywords());
+
+        assertEquals("PDFVersion", schem.getPDFVersionProperty().getPropertyName());
+        assertEquals(pdfVersion, schem.getPDFVersion());
+
+        assertEquals("Producer", schem.getProducerProperty().getPropertyName());
+        assertEquals(producer, schem.getProducer());
     }
 
     @Test