Skip to content

Commit 63ef266

Browse files
committed
PDFBOX-5660: expand test coverage
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1931006 13f79535-47bb-0310-9956-ffa450edef68
1 parent 3e6765c commit 63ef266

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ void testNoSchema() throws XmpParsingException
14151415
@Test
14161416
void testNoInstantiation() throws XmpParsingException
14171417
{
1418-
// Instantiation fails because of bad date
1418+
// Instantiation fails because of a bad date property
14191419
String s = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
14201420
"<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><?adobe-xap-filters esc=\"CRLF\"?><x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"XMP toolkit 2.9.1-13, framework 1.6\">\n" +
14211421
" <rdf:RDF xmlns:iX=\"http://ns.adobe.com/iX/1.0/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" +
@@ -1430,6 +1430,25 @@ void testNoInstantiation() throws XmpParsingException
14301430
assertEquals("Failed to instantiate DateType property with value 2019-05-02T22:03:5Z in xmp:CreateDate", ex.getMessage());
14311431
}
14321432

1433+
@Test
1434+
void testNoInstantiation2() throws XmpParsingException
1435+
{
1436+
// Instantiation fails because of a bad date attribute
1437+
String s =
1438+
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
1439+
"<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?><?adobe-xap-filters esc=\"CRLF\"?><x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"XMP toolkit 2.9.1-13, framework 1.6\">\n" +
1440+
" <rdf:RDF xmlns:iX=\"http://ns.adobe.com/iX/1.0/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n" +
1441+
" <rdf:Description xmlns:xap=\"http://ns.adobe.com/xap/1.0/\" xap:CreateDate=\"2016-03-09T19:47:1Z\">\n" +
1442+
" <xap:CreatorTool>PrimoPDF http://www.primopdf.com</xap:CreatorTool>\n" +
1443+
" </rdf:Description>\n" +
1444+
" </rdf:RDF>\n" +
1445+
"</x:xmpmeta><?xpacket end='w'?>";
1446+
final DomXmpParser xmpParser1 = new DomXmpParser();
1447+
XmpParsingException ex = assertThrows(XmpParsingException.class,
1448+
() -> xmpParser1.parse(s.getBytes(StandardCharsets.UTF_8)));
1449+
assertEquals("Failed to instantiate DateType property with value 2016-03-09T19:47:1Z in xap:CreateDate", ex.getMessage());
1450+
}
1451+
14331452
@Test
14341453
void testPDFBox6131() throws IOException, XmpParsingException, BadFieldValueException
14351454
{

0 commit comments

Comments
 (0)