aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-03-19 21:07:52 +0000
committerPJ Fanning <fanningpj@apache.org>2021-03-19 21:07:52 +0000
commitd96dd89e3541a4a3820d4cd559d43b2375c7fd5d (patch)
tree5f1a9ef5e2d993c2fe8653e44c0cdca135a092c1 /src
parent4027d8ac67ae3d72d939dabc15db88235e991ea5 (diff)
downloadpoi-d96dd89e3541a4a3820d4cd559d43b2375c7fd5d.tar.gz
poi-d96dd89e3541a4a3820d4cd559d43b2375c7fd5d.zip
add disabled test for corrupt file
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1887827 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hsmf/TestBasics.java36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hsmf/TestBasics.java b/src/scratchpad/testcases/org/apache/poi/hsmf/TestBasics.java
index a0a3d9fab7..ce219e3e04 100644
--- a/src/scratchpad/testcases/org/apache/poi/hsmf/TestBasics.java
+++ b/src/scratchpad/testcases/org/apache/poi/hsmf/TestBasics.java
@@ -19,21 +19,21 @@ package org.apache.poi.hsmf;
import static org.apache.poi.POITestCase.assertContains;
import static org.apache.poi.POITestCase.assertStartsWith;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-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.*;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.IOException;
import org.apache.poi.POIDataSamples;
+import org.apache.poi.hsmf.datatypes.AttachmentChunks;
+import org.apache.poi.hsmf.datatypes.DirectoryChunk;
import org.apache.poi.hsmf.exceptions.ChunkNotFoundException;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
/**
- * Tests to verify that we can perform basic opperations on
+ * Tests to verify that we can perform basic operations on
* a range of files
*/
public final class TestBasics {
@@ -241,4 +241,28 @@ public final class TestBasics {
chinese.guess7BitEncoding();
assertEquals("cp950", chinese.getRecipientDetailsChunks()[0].getRecipientDisplayNameChunk().get7BitEncoding());
}
+
+ @Disabled(value = "expected to fail")
+ @Test
+ void testCorruptFile() throws Exception {
+ POIDataSamples testData = POIDataSamples.getPOIFSInstance();
+ try(MAPIMessage mapi = new MAPIMessage(testData.openResourceAsStream("unknown_properties.msg"))) {
+ assertNotNull(mapi.getAttachmentFiles());
+ assertNotNull(mapi.getDisplayBCC());
+ assertNotNull(mapi.getMessageDate());
+
+ AttachmentChunks[] attachments = mapi.getAttachmentFiles();
+
+ for(AttachmentChunks attachment : attachments) {
+
+ DirectoryChunk chunkDirectory = attachment.getAttachmentDirectory();
+ if(chunkDirectory != null) {
+ MAPIMessage attachmentMSG = chunkDirectory.getAsEmbeddedMessage();
+ assertNotNull(attachmentMSG);
+ String body = attachmentMSG.getTextBody();
+ assertNotNull(body);
+ }
+ }
+ }
+ }
}