diff options
author | Paolo Mottadelli <paolo@apache.org> | 2009-07-20 17:10:43 +0000 |
---|---|---|
committer | Paolo Mottadelli <paolo@apache.org> | 2009-07-20 17:10:43 +0000 |
commit | 8c3825be73d3b5aa20a7931ec3536c649e2c0d2f (patch) | |
tree | dac7c653bdb9ff775694da0094a7ef2a65ecc748 /src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java | |
parent | 5aba781802dddfde5ac42c84e6fbdb998428fcce (diff) | |
download | poi-8c3825be73d3b5aa20a7931ec3536c649e2c0d2f.tar.gz poi-8c3825be73d3b5aa20a7931ec3536c649e2c0d2f.zip |
POIXMLproperties: core properties improvement + test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@795923 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java')
-rwxr-xr-x | src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java b/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java index 4349600ad6..c27619cec0 100755 --- a/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java +++ b/src/ooxml/testcases/org/apache/poi/TestPOIXMLProperties.java @@ -18,15 +18,20 @@ package org.apache.poi; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.apache.poi.xssf.XSSFTestDataSamples; +import java.io.File; import junit.framework.TestCase; +import org.apache.poi.openxml4j.opc.OPCPackage; +import org.apache.poi.xssf.XSSFTestDataSamples; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.apache.poi.xwpf.usermodel.XWPFDocument; + /** * Test setting extended and custom OOXML properties */ public class TestPOIXMLProperties extends TestCase { + public void testWorkbookExtendedProperties() throws Exception { XSSFWorkbook workbook = new XSSFWorkbook(); POIXMLProperties props = workbook.getProperties(); @@ -131,4 +136,24 @@ public class TestPOIXMLProperties extends TestCase { } + + public void testDocumentProperties() throws Exception { + File sampleFile = new File( + System.getProperty("HWPF.testdata.path") + + File.separator + "documentProperties.docx" + ); + assertTrue(sampleFile.exists()); + XWPFDocument sampleDoc; + sampleDoc = new XWPFDocument( + POIXMLDocument.openPackage(sampleFile.toString()) + ); + POIXMLProperties props = sampleDoc.getProperties(); + assertNotNull(props); + String title = props.getCoreProperties().getTitle(); + assertEquals("Hello World", title); + String creator = props.getCoreProperties().getCreator(); + assertEquals("Paolo Mottadelli", creator); + String subject = props.getCoreProperties().getSubject(); + assertEquals("Greetings", subject); + } }
\ No newline at end of file |