WiserAssertions: apply rule ReturnCount
This commit is contained in:
parent
97d67cb557
commit
cef89074ef
1 changed files with 8 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue