use of com.zimbra.client.ZMessage.ZMimePart in project zm-mailbox by Zimbra.
the class TestMessageIntercept method verifyInterceptMessage.
/**
* Verifies the structure of the intercept message.
*/
private void verifyInterceptMessage(ZMessage interceptMsg, String operation, String folderName, String folderId) throws Exception {
// Check structure
ZMimePart part = interceptMsg.getMimeStructure();
assertEquals(MimeConstants.CT_MULTIPART_MIXED, part.getContentType());
List<ZMimePart> children = part.getChildren();
assertEquals(2, children.size());
// Check body
ZMimePart bodyPart = children.get(0);
assertEquals(MimeConstants.CT_TEXT_PLAIN, bodyPart.getContentType());
String body = bodyPart.getContent();
String context = "Unexpected body: \n" + body;
assertTrue(context, body.contains("Intercepted message for " + RECIPIENT_NAME));
assertTrue(context, body.contains("Operation=" + operation));
assertTrue(context, body.contains("folder=" + folderName));
assertTrue(context, body.contains("folder ID=" + folderId));
// Compare to original message
ZMimePart interceptedPart = children.get(1);
assertEquals(MimeConstants.CT_MESSAGE_RFC822, interceptedPart.getContentType());
}
Aggregations