MdnMimeMessageInspector { public String getPlainTextPartAsText() { try { return (String) getPlainTextBodyPart().getContent(); } catch (Exception e) { throw new IllegalStateException("Unable to retrieve the plain text from the MDN: " + e.getMessage(), e); } } MdnMimeMessageInspector(MimeMessage mdnMimeMessage); MimeMultipart getSignedMultiPart(); MimeMultipart getMultipartReport(); BodyPart getPlainTextBodyPart(); BodyPart getMessageDispositionNotificationPart(); String getPlainTextPartAsText(); Map<String, String> getMdnFields(); boolean isOkOrWarning(Mic outboundMic);  }
@Test public void parseOpenAS2MDN() throws Exception { InputStream resourceAsStream = MdnMimeMessageInspectorTest.class.getClassLoader().getResourceAsStream(OPENAS2_MDN_TXT); assertNotNull(resourceAsStream, "Unable to find " + OPENAS2_MDN_TXT + " in class path"); MimeMessage mimeMessage = MimeMessageHelper.parse(resourceAsStream); MdnMimeMessageInspector mdnMimeMessageInspector = new MdnMimeMessageInspector(mimeMessage); String plainText = mdnMimeMessageInspector.getPlainTextPartAsText(); assertNotNull(plainText); }