Author: tilman
Date: Mon Dec 29 09:58:04 2025
New Revision: 1930960

Log:
PDFBOX-6133: expand test

Modified:
   
pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java

Modified: 
pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
==============================================================================
--- 
pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
        Mon Dec 29 09:38:29 2025        (r1930959)
+++ 
pdfbox/branches/2.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
        Mon Dec 29 09:58:04 2025        (r1930960)
@@ -1578,12 +1578,12 @@ public class DomXmpParserTest
     }
 
     @Test
-    public void testPDFBox6133() throws IOException, XmpParsingException, 
BadFieldValueException
+    public void testPDFBox6133() throws IOException, XmpParsingException, 
BadFieldValueException, TransformerException
     {
         // Namespace is used both for the schema and the type,
         // and that there are two types with the same namespace
         InputStream is = 
DomXmpParser.class.getResourceAsStream("/org/apache/xmpbox/xml/PDFBOX-6133-0064638.xml");
-            DomXmpParser xmpParser = new DomXmpParser();
+        DomXmpParser xmpParser = new DomXmpParser();
         XMPMetadata xmp = xmpParser.parse(is);
         XMPSchema epaSchema = 
xmp.getSchema("http://www.epo.org/patent-bibliographic-data/1.0/";);
         assertEquals("[TotalNumberOfPages=RealType:47.0]", 
epaSchema.getProperty("TotalNumberOfPages").toString());
@@ -1600,6 +1600,27 @@ public class DomXmpParserTest
         assertEquals("[DocumentSection=TextType:cited-references]", 
struct4.getProperty("DocumentSection").toString());
         assertEquals("[StartPage=RealType:47.0]", 
struct4.getProperty("StartPage").toString());
         assertEquals("[NumberOfPages=RealType:1.0]", 
struct4.getProperty("NumberOfPages").toString());
+
+        // Serialize and repeat to ensure nothing was broken in serialization
+        XmpSerializer serializer = new XmpSerializer();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        serializer.serialize(xmp, baos, true);
+        xmp = new DomXmpParser().parse(baos.toByteArray());
+        epaSchema = 
xmp.getSchema("http://www.epo.org/patent-bibliographic-data/1.0/";);
+        assertEquals("[TotalNumberOfPages=RealType:47.0]", 
epaSchema.getProperty("TotalNumberOfPages").toString());
+        pub = (DefinedStructuredType) epaSchema.getProperty("Publication");
+        assertEquals("[CountryCode=TextType:EP]", 
pub.getProperty("CountryCode").toString());
+        classification = (ArrayProperty) 
epaSchema.getProperty("Classification");
+        assertEquals(4, classification.getAllProperties().size());
+        class3 = (TextType) classification.getAllProperties().get(3);
+        assertEquals("A61K 39/215 20060101ALI20160203BHEP", 
class3.getStringValue());
+        assertEquals("CORONAVIRUS", 
epaSchema.getUnqualifiedLanguagePropertyValue("Title", "de"));
+        documentStructure = (ArrayProperty) 
epaSchema.getProperty("DocumentStructure");
+        assertEquals(5, documentStructure.getAllProperties().size());
+        struct4 = (DefinedStructuredType) 
documentStructure.getAllProperties().get(4);
+        assertEquals("[DocumentSection=TextType:cited-references]", 
struct4.getProperty("DocumentSection").toString());
+        assertEquals("[StartPage=RealType:47.0]", 
struct4.getProperty("StartPage").toString());
+        assertEquals("[NumberOfPages=RealType:1.0]", 
struct4.getProperty("NumberOfPages").toString());
         is.close();
     }
 

Reply via email to