From cef89074ef1a110aba0f4f11bab2376139a584a0 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Thu, 2 Jun 2016 20:52:41 +0100 Subject: [PATCH] WiserAssertions: apply rule ReturnCount --- .../kemitix/wiser/assertions/WiserAssertions.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java b/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java index e583c72..9ec032e 100644 --- a/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java +++ b/src/main/java/net/kemitix/wiser/assertions/WiserAssertions.java @@ -181,16 +181,20 @@ public final class WiserAssertions { private String getMimeMessageBody(final WiserMessage message) throws IOException, MessagingException { Object content = getMimeMessage(message).getContent(); + String result = null; if (content instanceof String) { - return (String) content; + result = (String) content; } if (content instanceof MimeMessage) { - return content.toString(); + result = content.toString(); } if (content instanceof MimeMultipart) { - return getMimeMultipartAsString((MimeMultipart) content); + result = getMimeMultipartAsString((MimeMultipart) content); } - throw new RuntimeException("Unexpected MimeMessage content"); + if (result == null) { + throw new RuntimeException("Unexpected MimeMessage content"); + } + return result; } /**