WiserAssertions.getMimeMessageBody: accept that content may be a String

Spring's SimpleMailMessage doesn't wrap it's email body in a mime content
type as it is just a 'simple' mail message.

Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
This commit is contained in:
Paul Campbell 2016-02-16 22:55:38 +00:00
parent 146f53e404
commit eff6e6c0b3

View file

@ -181,6 +181,9 @@ public final class WiserAssertions {
private String getMimeMessageBody(final WiserMessage message)
throws IOException, MessagingException {
Object content = getMimeMessage(message).getContent();
if (content instanceof String) {
return (String) content;
}
if (content instanceof MimeMessage) {
return content.toString();
}