htmlEmail.setHtmlMsg(htmlMsg);
htmlEmail.buildMimeMessage();
MimeMessage mm = htmlEmail.getMimeMessage();
mm.saveChanges();
MimeMessageParser mmp = new MimeMessageParser(mm);
mmp.parse();
List<?> attachments = mmp.getAttachmentList();
assertEquals("Attachment size", 1, attachments.size());
DataSource ds = (DataSource) attachments.get(0);
assertEquals("Content type", contentType, ds.getContentType());
}