List of usage examples for org.apache.poi.hsmf.datatypes AttachmentChunks getAttachFileName
public StringChunk getAttachFileName()
From source file:org.silverpeas.core.mail.MsgMailExtractorIT.java
License:Open Source License
/** * This unit test is support for MSG exploration solution testing. * * @throws Exception/*from ww w . j a v a 2s .c om*/ */ @Test public void readMailWithAttachmentsMSG() throws Exception { MAPIMessage msg = new MAPIMessage(getDocumentFromName(FILENAME_MAIL_WITH_ATTACHMENTS).getPath()); msg.setReturnNullOnMissingChunk(true); assertThat(msg.getDisplayFrom(), is("Nicolas Eysseric")); assertThat(msg.getRecipientDetailsChunks(), is(notNullValue())); assertThat(msg.getRecipientDetailsChunks().length, is(2)); assertThat(msg.getRecipientDetailsChunks()[0].getRecipientName(), is("Aurore ADR. DELISSNYDER")); assertThat(msg.getRecipientDetailsChunks()[0].getRecipientEmailAddress(), is("Aurore.DELISSNYDER@hydrostadium.fr")); assertThat(msg.getRecipientDetailsChunks()[1].getRecipientName(), is("Ludovic BERTIN")); assertThat(msg.getRecipientDetailsChunks()[1].getRecipientEmailAddress(), is("ludovic.bertin@oosphere.com")); AttachmentChunks[] attachments = msg.getAttachmentFiles(); assertThat(attachments, is(notNullValue())); assertThat(attachments.length, is(2)); if (attachments != null && attachments.length > 0) { System.out.print("\n"); for (AttachmentChunks attachmentChunks : attachments) { System.out.println(attachmentChunks.getAttachFileName().getValue()); } } else { System.out.println("None."); } System.out.println("DATE : " + DateUtil.getOutputDateAndHour(getMessageDate(msg), "fr")); System.out.println("BODY : "); System.out.println(">>>"); System.out.println(getMessageBody(msg)); System.out.println("<<<"); }