WiserAssertions: apply rule ReturnCount

This commit is contained in:
Paul Campbell 2016-06-02 20:52:41 +01:00
parent 97d67cb557
commit cef89074ef

View file

@ -181,17 +181,21 @@ public final class WiserAssertions {
private String getMimeMessageBody(final WiserMessage message) private String getMimeMessageBody(final WiserMessage message)
throws IOException, MessagingException { throws IOException, MessagingException {
Object content = getMimeMessage(message).getContent(); Object content = getMimeMessage(message).getContent();
String result = null;
if (content instanceof String) { if (content instanceof String) {
return (String) content; result = (String) content;
} }
if (content instanceof MimeMessage) { if (content instanceof MimeMessage) {
return content.toString(); result = content.toString();
} }
if (content instanceof MimeMultipart) { if (content instanceof MimeMultipart) {
return getMimeMultipartAsString((MimeMultipart) content); result = getMimeMultipartAsString((MimeMultipart) content);
} }
if (result == null) {
throw new RuntimeException("Unexpected MimeMessage content"); throw new RuntimeException("Unexpected MimeMessage content");
} }
return result;
}
/** /**
* Checks that at least on message matches the predicate or the supplied * Checks that at least on message matches the predicate or the supplied