mirror of https://github.com/apache/poi.git
add test for reading core properties from ooxml strict file
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1886514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1f50c10ab0
commit
92134f34b1
|
@ -26,11 +26,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.poi.POIDataSamples;
|
||||
import org.apache.poi.ooxml.POIXMLProperties.CoreProperties;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
|
@ -319,6 +322,16 @@ public final class TestPOIXMLProperties {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testOoxmlStrict() throws Exception {
|
||||
POIDataSamples _ssTests = POIDataSamples.getSpreadSheetInstance();
|
||||
try (OPCPackage pkg = OPCPackage.open(_ssTests.openResourceAsStream("sample.strict.xlsx"))) {
|
||||
POIXMLProperties props = new POIXMLProperties(pkg);
|
||||
assertNotNull(props.getCoreProperties().getCreated());
|
||||
assertEquals(2007, props.getCoreProperties().getCreated().toInstant().atZone(ZoneId.of("UTC")).getYear());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testBug60977() throws IOException {
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
|
Loading…
Reference in New Issue