Skip to content

Commit 4dbc6e6

Browse files
committed
PDFBOX-6133: expand test
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1930962 13f79535-47bb-0310-9956-ffa450edef68
1 parent c03752c commit 4dbc6e6

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

xmpbox/src/test/java/org/apache/xmpbox/xml/DomXmpParserTest.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1496,7 +1496,7 @@ void testPDFBox6131_2() throws IOException, XmpParsingException
14961496
}
14971497

14981498
@Test
1499-
void testPDFBox6133() throws IOException, XmpParsingException, BadFieldValueException
1499+
void testPDFBox6133() throws IOException, XmpParsingException, BadFieldValueException, TransformerException
15001500
{
15011501
// Namespace is used both for the schema and the type,
15021502
// and that there are two types with the same namespace
@@ -1519,6 +1519,27 @@ void testPDFBox6133() throws IOException, XmpParsingException, BadFieldValueExce
15191519
assertEquals("[DocumentSection=TextType:cited-references]", struct4.getProperty("DocumentSection").toString());
15201520
assertEquals("[StartPage=RealType:47.0]", struct4.getProperty("StartPage").toString());
15211521
assertEquals("[NumberOfPages=RealType:1.0]", struct4.getProperty("NumberOfPages").toString());
1522+
1523+
// Serialize and repeat to ensure nothing was broken in serialization
1524+
XmpSerializer serializer = new XmpSerializer();
1525+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
1526+
serializer.serialize(xmp, baos, true);
1527+
xmp = new DomXmpParser().parse(baos.toByteArray());
1528+
epaSchema = xmp.getSchema("http://www.epo.org/patent-bibliographic-data/1.0/");
1529+
assertEquals("[TotalNumberOfPages=RealType:47.0]", epaSchema.getProperty("TotalNumberOfPages").toString());
1530+
pub = (DefinedStructuredType) epaSchema.getProperty("Publication");
1531+
assertEquals("[CountryCode=TextType:EP]", pub.getProperty("CountryCode").toString());
1532+
classification = (ArrayProperty) epaSchema.getProperty("Classification");
1533+
assertEquals(4, classification.getAllProperties().size());
1534+
class3 = (TextType) classification.getAllProperties().get(3);
1535+
assertEquals("A61K 39/215 20060101ALI20160203BHEP", class3.getStringValue());
1536+
assertEquals("CORONAVIRUS", epaSchema.getUnqualifiedLanguagePropertyValue("Title", "de"));
1537+
documentStructure = (ArrayProperty) epaSchema.getProperty("DocumentStructure");
1538+
assertEquals(5, documentStructure.getAllProperties().size());
1539+
struct4 = (DefinedStructuredType) documentStructure.getAllProperties().get(4);
1540+
assertEquals("[DocumentSection=TextType:cited-references]", struct4.getProperty("DocumentSection").toString());
1541+
assertEquals("[StartPage=RealType:47.0]", struct4.getProperty("StartPage").toString());
1542+
assertEquals("[NumberOfPages=RealType:1.0]", struct4.getProperty("NumberOfPages").toString());
15221543
}
15231544
}
15241545

0 commit comments

Comments
 (0)