Author: tilman
Date: Mon Dec 29 09:58:08 2025
New Revision: 1930961
Log:
PDFBOX-6133: expand test
Modified:
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
Modified:
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
==============================================================================
---
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
Mon Dec 29 09:58:04 2025 (r1930960)
+++
pdfbox/branches/3.0/xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java
Mon Dec 29 09:58:08 2025 (r1930961)
@@ -1500,7 +1500,7 @@ class DomXmpParserTest
}
@Test
- void testPDFBox6133() throws IOException, XmpParsingException,
BadFieldValueException
+ 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
@@ -1523,6 +1523,27 @@ 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());
}
}