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
This commit is contained in:
Dominik Stadler 2015-03-22 21:48:27 +00:00
parent 7c9ead8ad7
commit 0f0995d4ab

View File

@ -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");