From dd875c9c040ac0e42326bb3c5b76a1d6748908ed Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sun, 22 Mar 2015 21:48:27 +0000 Subject: [PATCH] Integration test: Do a few more things with the MapiMessage git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1668485 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/stress/HSMFFileHandler.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/integrationtest/org/apache/poi/stress/HSMFFileHandler.java b/src/integrationtest/org/apache/poi/stress/HSMFFileHandler.java index 9de8b798c5..d68504a04c 100644 --- a/src/integrationtest/org/apache/poi/stress/HSMFFileHandler.java +++ b/src/integrationtest/org/apache/poi/stress/HSMFFileHandler.java @@ -22,6 +22,8 @@ import java.io.FileInputStream; import java.io.InputStream; import org.apache.poi.hsmf.MAPIMessage; +import org.apache.poi.hsmf.datatypes.AttachmentChunks; +import org.apache.poi.hsmf.datatypes.DirectoryChunk; import org.junit.Test; public class HSMFFileHandler extends POIFSFileHandler { @@ -32,6 +34,19 @@ public class HSMFFileHandler extends POIFSFileHandler { assertNotNull(mapi.getDisplayBCC()); assertNotNull(mapi.getMessageDate()); + AttachmentChunks[] attachments = mapi.getAttachmentFiles(); + + for(AttachmentChunks attachment : attachments) { + + DirectoryChunk chunkDirectory = attachment.attachmentDirectory; + if(chunkDirectory != null) { + MAPIMessage attachmentMSG = chunkDirectory.getAsEmbededMessage(); + assertNotNull(attachmentMSG); + String body = attachmentMSG.getTextBody(); + assertNotNull(body); + } + } + /* => Writing isn't yet supported... // write out the file File file = TempFile.createTempFile("StressTest", ".msg"); -- 2.39.5